提交处理程序不起作用 [英] Submit Handler not working
本文介绍了提交处理程序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在下面使用的代码可以正确验证,但在字段有效时不提交:
The code I am using below is validating correctly but not submitting when fields are valid:
<script>
$(document).ready(function(){
$("#verifyformDesktop").validate({
errorContainer: "#messageBox1, #messageBox2",
errorLabelContainer: "#messageBox1 ul",
wrapper: "li", debug:true,
submitHandler: function(form) {
form.submit();
}
})
});
</script>
<form name="verifyformDesktop" id="verifyformDesktop" action="php/verify.php" method="post">
...
<input type="submit" name="submit" id="submit" value="ENTER">
也许是SubmitHandler?
Maybe the submitHandler?
推荐答案
从.validate()
选项中删除debug: true,
.
它仅用于测试和阻止submit
.
调试::启用调试模式.如果为true,则不提交表单...
debug: Enables debug mode. If true, the form is not submitted...
http://docs.jquery.com/Plugins/Validation/validate#toptions
工作演示:
您也不需要声明submitHandler:
函数...
You also do not need to declare a submitHandler:
function...
submitHandler: function(form) {
form.submit();
}
...,因为这只是您忽略它时的默认插件行为.
... because that's simply the default plugin behavior when you leave it out.
但是,如果您需要做其他事情,那是正确的...
However, if you need to do other things, then it is correct...
submitHandler: function(form) {
// do some other stuff before submit
form.submit();
}
这篇关于提交处理程序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文