我试图强制提交我的表单,问题是我使用bootboxjs (即使用异步代码)在提交前进行确认对话框,这正是我想要的,也是以这种方式验证所需的输入。如何强制提交 - 提交事件中的异步代码
这是我的JS代码结构:
$("#myForm").submit(function(e){
bootbox.confirm({
message: "Are you sure?",
buttons: {
confirm: {
label: 'Yes',
className: 'btn-danger'
},
cancel: {
label: 'NO, STOP!',
className: 'btn-primary'
}
},
callback: function (result){
if (result)
{
// Some code to set values to hidden inputs and another irrelevant stuff...
// The right command (that I didn't know) to force the form
}
}
});
return false;
});
我怎样才能避免此问题并保留所需投入的验证?
你能澄清更多的问题浏览器的默认提交! – PacMan
问题是,我不知道如何在做一些事情后强制**提交表单(请参阅我的问题中的JavaScript代码)。 – candlejack