Duplicate Errors Using jquery.validate on Dynamic Forms

Posted: April 26, 2010 in JavaScript

I have a form that clones a div upon clicking an add button. For validation I use the jquery.validate plugin. When the add button is clicked, I exectute the following to clear the errors.

validator.resetForm();

However, if inline errors are displayed before this being called, and then they are displayed again after the form is reset, the inline errors are displayed one time on the first div, two times on the second div, and so-forth. The alleviate this issue I’m now destroying the error element.

validator.resetForm();
$('label.error').remove();
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s