Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果选中了Coldfusion/Javascript复选框_Javascript_Jquery_Coldfusion - Fatal编程技术网

如果选中了Coldfusion/Javascript复选框

如果选中了Coldfusion/Javascript复选框,javascript,jquery,coldfusion,Javascript,Jquery,Coldfusion,在这件事上我真的需要一些帮助。我正在修改别人的代码。基本上,脚本的作用是通过coldfusion循环数据。假设用户将数据插入到每个循环项中。完成后,会弹出javascript框,确认用户输入的数据是正确的。这个很好用。。。我遇到的问题是,我需要在他们单击的每个循环表单旁边设置一个复选框,以选择要提交的循环表单。我已经让coldfusion部分很容易工作了。。但是,我只需要验证框来验证已选中的表单 确认框变量示例 <cfset VARIABLES["PromptMessage" &

在这件事上我真的需要一些帮助。我正在修改别人的代码。基本上,脚本的作用是通过coldfusion循环数据。假设用户将数据插入到每个循环项中。完成后,会弹出javascript框,确认用户输入的数据是正确的。这个很好用。。。我遇到的问题是,我需要在他们单击的每个循环表单旁边设置一个复选框,以选择要提交的循环表单。我已经让coldfusion部分很容易工作了。。但是,我只需要验证框来验证已选中的表单

确认框变量示例

<cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & "<br /><br /><strong>LEASE:</strong>&nbsp;">
                    <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] & "&nbsp;|&nbsp;L. CYCLES: <strong style=""color:black"">' + $('##LE_LCYCLES#CurrentRow#').val() + '</strong>">
                    <cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & "&nbsp;|&nbsp;R. HRS: <strong style=""color:black"">' + $('##LE_REFH#CurrentRow#').val() + '</strong>">
                    <cfset VARIABLES["PromptMessage" & CurrentRow] = VARIABLES["PromptMessage" & CurrentRow] & "&nbsp;|&nbsp;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>

$(文档).ready(函数(){
//捕获提交
$(“##btn_提交”)。单击(功能(e){
jConfirm(“确认您的发动机使用信息。单击“确认”继续,或单击“编辑”编辑您的值。#变量[“PromptMessage”&x]#
,'报告确认对话框',函数(r){ //如果他们确认,手动触发表单提交 如果(r)$(“##btn#U提交”)。家长(“表格”)。提交(); }); //这里总是返回false,因为我们不知道jConfirm将要做什么 返回false; }); }); $(文档).ready(函数(){ 变量$dialog=$('') .html('每次都会显示此对话框!') .对话({ 自动打开:错误, 标题:“基本对话框”, 莫代尔:是的, 身高:400, 按钮:{ “删除所有项目”:函数(){ $(此).dialog(“关闭”); }, 取消:函数(){ $(此).dialog(“关闭”); } } }); $('##弹出框')。单击(函数(){ $dialog.dialog('open'); //防止默认操作,例如,跟踪链接 返回false; }); });

请记住,它是通过查询循环的。

我建议您重新设计表单。与其将所有内容与查询的行号相关联,不如将它们与记录的id字段相关联。这样他们会更容易相处

如果所有复选框都具有相同的名称但值不同,则它们将更易于使用。大概是这样的:

<cfoutput query="somequery">
<input type="checkbox" name="processme" value="#id#">
</cfoutput>

然后,在处理表单时,可以执行一个简单的循环

<cfif StructKeyExists(form, "processme")>
<cfloop list = "#form.processme#" index="ThisID">
code
closing tags

代码
结束标记

您尝试过什么?我检查了你的代码两次,看看你可能在哪里试图解决这个问题,但我就是找不到。如果我忽略了它,请原谅我。例如,您甚至没有为复选框指定一个ID或类供jQuery引用。@DavidThomas这是ColdFusion中的转义字符。变量由
引用,例如
\variablename
@CoderSeven:谢谢您的更正。=)@CoderSeven我不是javascript的高手。事实上,我避免了它,就像是一条辫子。Coldfusion内置了我使用的AJAX,这就是我所使用的全部。这背后的原因是,我们处理的许多公司客户端通常在浏览器上关闭javascript。更不用说cf中的Ajax内容只是为您将js写入客户端。一些自制的但主要是extjs库,因此您试图避免使用js和假设js被禁用是错误的。最后我做了类似的事情。我基本上选择了我想要的飞机。。刷新页面并仅在选定飞机的情况下重新运行查询。。然后在新页面上自动弹出javascript。这模拟了提交时的弹出窗口,只允许选定的飞机出现并填充弹出窗口。