jQuery Validate - resetForm() Not Behaving as Expected
- by Kevin C.
Site in question is http://epraxadev.com/kw/palisade-palms/
"Click here for brochure" and "Learn More about Palisade Palms" both bring up a lightbox with the same HTML form to be filled out...the "learn more..." link also changes some of the HTML in the form (the value for a hidden form field, and the fields required).
I'm using Colorbox for the lightbox, and for its onClosed event, I have this to reset the form:
onClosed: function() {
$('#brochure-form label em').remove();
$('#brochure-form').data('validator').resetForm();
}
Now here's the problem:
User tries to submit the "brochure" form, but it fails validation. User closes the lightbox.
User opens up the "Learn more" lightbox, and tries to submit the form...now, instead of using the correct validation rules (only requiring e-mail and referrer), it requires all fields to be filled out (as is the case with the "Brochure Form")
Is there something that I can add to the onClosed function, to clean up all the validation rules?
Thanks guys!