如何禁用“渴望”验证完全使用jquery validate?
有没有办法使用 jquery.validate 插件禁用“急切”验证?通过脚本中的选项还是作为黑客?一旦表单被验证一次,“急切”验证就会启动 - 之后,无效字段将在焦点退出时进行验证。我想禁用此行为,并将我的表单更改为仅在按下提交按钮时才进行验证。
我也不介意破解验证脚本本身,所以如果这是解决方案所需要的,那么这是可以接受的。
Is there a way to disable "eager" validation using the jquery.validate plugin? Either through an option in the script or as a hack? "Eager" validation kicks in once the form has been validated once - after that, invalid fields are validated onfocusout. I want to disable this behavior, and change my forms to only be validated when the submit button is pressed.
I don't mind hacking through the validate script itself also, so if that's what the solution requires that's acceptable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 onfocusout 选项。
onfocusout, boolean, default:true
“在模糊时验证元素(复选框/单选按钮除外)。如果未输入任何内容,则跳过所有规则,除非该字段已标记为无效。 ”
大约一半。
因此要禁用“急切”验证:
Check out the onfocusout option.
onfocusout, boolean, default:true
"Validate elements (except checkboxes/radio buttons) on blur. If nothing is entered, all rules are skipped, except when the field was already marked as invalid."
About halfway down.
So to disable "eager" validation: