jQuery 验证 ResetForm 不起作用添加到 Onclick 复选框
我编写了一个小脚本,通过单击复选框将帐单地址复制到送货地址表单字段。
我已添加 validate.resetForm();
作为此处建议:以确保当前表单错误已清除。
这似乎不起作用并且没有清除任何错误。
步骤:
- 点击“保存”按钮,显示错误消息。
- 在“帐单地址”中输入详细信息
- 检查“与预订信息相同”
如何清除所有错误,甚至在单击复选框后重新验证表格?
I wrote a small script which copies the billing address to the delivery address form fields onclick of a checkbox.
I have added validate.resetForm();
as suggested here: to ensure that the current form errors are cleared.
This doesn't seem to be working and clearing no errors.
Example: http://jsfiddle.net/c5Qkt/
Steps:
- Click the "Save" button, displays error messages.
- Enter details in "Billing Address"
- Check the "Same as Booking information"
How can I clear all errors and maybe even re-validate the form after click the checkbox?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题是
resetForm
是validate.validate(...)
返回的验证器对象上的方法,而不是 jQuery 对象本身的方法。修复了小提琴 http://jsfiddle.net/pjucc/您想要触发验证的函数是
.form()
Your problem is that
resetForm
is a method on the validator object returned byvalidate.validate(...)
, and not on the jQuery object itself. Fixed fiddle http://jsfiddle.net/pjucc/The function you want to trigger validation instead is
.form()