我真的可以在这方面使用一些帮助。我正在修改别人的代码。基本上该脚本所做的是它通过冷融合循环数据。假设用户将数据插入到这些循环项中的每一个中。然后一旦完成,就会弹出 javascript 框并确认用户输入的数据是正确的。这很好用......我遇到的问题是我需要在每个循环表单旁边有一个复选框,他们单击以选择他们要提交的循环表单。我已经让 Coldfusion 部分轻松工作。但是,我需要验证框来仅验证已检查的表格。
确认框变量示例
<cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & "<br /><br /><strong>LEASE:</strong> ">
<cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & "L. HRS: <strong style=""color:black"">' + $('##LE_LEFH#CurrentRow#').val() + '</strong>">
<cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & " | L. CYCLES: <strong style=""color:black"">' + $('##LE_LCYCLES#CurrentRow#').val() + '</strong>">
<cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & " | R. HRS: <strong style=""color:black"">' + $('##LE_REFH#CurrentRow#').val() + '</strong>">
<cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & " | L. CYCLES: <strong style=""color:black"">' + $('##LE_RCYCLES#CurrentRow#').val() + '</strong>">
<cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & "<br /><br />">
复选框示例
<div style="color:##ff0000;background-color:;background-color:##dadada;border-left:1px solid ##999;border-right:1px solid ##999;border-bottom:1px solid ##999;"><input type="Checkbox" name="Confirm#CurrentRow#" value="1"> <strong>Select to report engine usage for this aircraft.</strong></div></div>
确认框操作代码。
<script type="text/javascript">
$(document).ready(function(){
// catch submit
$("##btn_submit").click(function(e){
jConfirm('<strong>Confirm your engine usage information. Click Confirm to proceed or Edit to edit your values.</strong><cfloop from="1" to="10" index="x">#VARIABLES["PromptMessage" & x]#</cfloop><br />', 'Report Confirmation Dialog', function(r) {
// If they confirmed, manually trigger a form submission
if (r) $("##btn_submit").parents("FORM").submit();
});
// Always return false here since we don't know what jConfirm is going to do
return false;
});
});
$(document).ready(function() {
var $dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog({
autoOpen: false,
title: 'Basic Dialog',
modal: true,
height: 400,
buttons: {
"Delete all items": function() {
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
$('##popup').click(function() {
$dialog.dialog('open');
// prevent the default action, e.g., following a link
return false;
});
});
</script>
请记住,它是通过查询循环的。