使用cfmessagebox上的Yes按钮提交表单

时间:2015-03-02 23:09:12

标签: coldfusion

我可以弹出yesno cfmessagebox,但无论点击什么按钮,结果总是提交。我需要提交yes按钮,但是没有按钮不采取任何行动。我试图模仿很多例子,但似乎没什么用。任何帮助表示赞赏。感谢

<cfform name="DeleteForm" action="SubmitESPDeleteAction.cfm" method="post" style="margin:30px;" >

<cfinput name="DeleteButton" type="text" required="yes" style="color:red;" >

<cfinput name="ConfirmDelete" type="submit" onclick="javascript:ColdFusion.MessageBox.show('CONFIRMTest')" value="Delete Record" >

<cfmessagebox name="CONFIRMTest" type="confirm" message="Are you sure you would like to delete this record?" buttonType="yesno" >

<script lang="javascript" type="text/javascript"  >

    function CONFIRMTest(btn)
        {if (btn == 'yes')
            submit(DeleteForm)
        }


</script>

1 个答案:

答案 0 :(得分:1)

问题在于JavaScript函数条件语句。原始代码不是指定布尔条件,而是将btn的值设置为&#34;是&#34;。

之前

    if (btn = 'yes')

<强>后

    if (btn == 'yes')