我在 struts 中使用 jquery-1.4.4。我已成功使用 jquery.validate 插件并验证了我的请求表单。但由于它是一个 3 页的表单,我必须在每个页面上给出一个确认对话框,以确保用户重新检查他们的表单条目。
$(document).ready(function() {
:::
$("#Form1").validate({
::
});
function onSubmitForm(){
var vconf = confirm(" You are about to submit, please recheck the the fields");
if(vconf){
return true;
}else{
return false;
}
}
});
和我的提交按钮
<input type="submit" title="continue filling up the form" value=" Continue "
onclick= "return onSubmitForm();"/>
这首先调用我的确认对话框,然后进行验证,这不适合首先询问用户他是否真的想继续然后阻止他们说他们的表单无效。