moarboilerplate
moarboilerplate

Reputation: 1643

jquery validate - redefine registration/settings after initial call to validate()?

I am running into issues with using the jquery validate plugin on a page where I am asynchronously loading content with .load(). I am reloading a section of the page where my registered errorContainer exists, and I can't figure out a way to re-register the setting after the content is loaded with another call to validate(). I took a look at the internals of the plugin and it looks like the initialization/registration of the settings and properties isn't happening in the validate method because the validator object exists and the initialization is skipped over. Is there any supported way to reregister or edit these settings? I am using version 1.8.1.

Edit: I understand I can probably work around this by using the showErrors callback or using some custom css class to position the auto-generated label where I need it, but I'm interested in knowing if there is a way to maintain the use of errorContainer by modifying the setting I've provided in validate() without having to resort to a workaround.

Upvotes: 1

Views: 1048

Answers (1)

Sparky
Sparky

Reputation: 98738

The short answer is "no".

Once the .validate() method is invoked, the plugin is initialized. Since any subsequent call to .validate() is ignored, there is no way to change any of the options. There are no workarounds.

The only exception to this are the rules & messages options which can be modified at any time using the .rules('add') and .rules('remove') methods.


Any contact with the developer, bug reports, feature requests, etc, should be done at his GitHub page:

https://github.com/jzaefferer/jquery-validation/issues

Upvotes: 2

Related Questions