Today I needed to change one of the options that my form validator was initialized with. Sounds pretty simple, but for the life of me I couldn't find anything like setOption() or .validate("option", {}) like other plugins have.
Turns out that Validate actually makes it too simple. Where other plugins give you non-standardized functions to update the options, Validate gives you the options object directly... but they call it settings.
I can disable the auto onsubmit validation by doing the following:
$("#myForm").validate().settings.onsubmit = false;This works because .validate() returns the current validator for the form, and the validator neatly exposes the settings collection.
No comments:
Post a Comment