使用jquery ui对话框确认提交表单的操作 [英] Using jquery ui dialog to confirm action for form submission
本文介绍了使用jquery ui对话框确认提交表单的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在页面上有多个表单,对于每个表单,我希望用户在提交表单之前进行确认.但是,当用户确认提交时,如何让此对话框知道用户正在汇总表格?是否带有自定义参数?谢谢.
I have multiple forms on a page, for each of them I want the user to confirm before form submission. but when the user confirms to submit, how do I let this dialog know which form the user is sumbitting? Does it take custom parameters? Thanks.
$("#dialog-confirm").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
'Confirm submit': function() {
document.______???????_____.submit();
},
Cancel: function() {
$(this).dialog('close');
}
}
});
$('.allForms').submit(function(){
$('#dialog-confirm').dialog('open');
});
推荐答案
您可以将其存储在这样的变量中:
You can store it in a variable like this:
var currentForm;
$("#dialog-confirm").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
'Confirm submit': function() {
currentForm.submit();
},
Cancel: function() {
$(this).dialog('close');
}
}
});
$('.allForms').submit(function(){
currentForm = this;
$('#dialog-confirm').dialog('open');
return false;
});
由于您只是使用它而立即离开页面,因此没有真正的理由使它变得比这更复杂.
Since you're just using this and immediately just leaving the page, no real reason to make it any more complicated than that.
这篇关于使用jquery ui对话框确认提交表单的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文