Reputation: 16793
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:
How can I clear all errors and maybe even re-validate the form after click the checkbox?
Upvotes: 1
Views: 1364
Reputation: 34408
Your problem is that resetForm
is a method on the validator object returned by validate.validate(...)
, and not on the jQuery object itself. Fixed fiddle http://jsfiddle.net/pjucc/
var theForm = $(".validate");
var validate = null;
if (theForm.length) {
validate = theForm.validate({ ... });
}
:
validate.form();
The function you want to trigger validation instead is .form()
Upvotes: 3