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?
Your problem is that
resetFormis 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()