简体   繁体   English

jQuery验证自定义验证器触发过多

[英]Jquery validation custom validator firing too often

I have written a custom validator function for the jquery validation module. 我已经为jquery验证模块编写了一个自定义验证器函数。 It works correctly and performa the correct validation. 它可以正常工作并执行正确的验证。

When you submit the form for the first time tbe validation function is called once on the submit. 首次提交表单时,将在提交时调用一次验证功能。 However once the form has discovered errors it appears to call the custom validation function (and the built in ones) on every keystroke. 但是,一旦表单发现错误,它似乎会在每次击键时调用自定义验证功能(以及内置的验证功能)。 How can I prevent this on my custom validator? 如何在我的自定义验证器上防止这种情况? I only want it to be called when the user next clicks submit and not when they type in the corresponding text field 我只希望在用户下次单击提交时调用它,而不是在用户在相应的文本字段中键入时调用它

Thanks a lot for your help 非常感谢你的帮助

It is a little bit hidden in the documentation 它有点隐藏在文档中

See http://validation.bassistance.de/validate/ - onkeyup http://validation.bassistance.de/validate/ - 的onkeyup

Example: Disables onkeyup validation.

$(".selector").validate({
  onkeyup: false
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM