validate plugin - use twice with different options on same form?
How can I use the same form with two distinct sets of validation options? From what I can tell the following isn't possible because validate caches the validator object inside the $("#frm1").data() object. What's the best way to clear this?
I tried this:
- // first call just validates for an ajax call that just changes the display
- if($("#frm1").validate(options1).form()) {
- // do ajax call and update display
- } else {
- // reset form showing errors
- }
- // second call is reached only after 1st is validated successfully
- if(
$("#frm1").validate(
options2).form()) {
- // submit form, but really only care about half of the fields
- } else {
- // reset form showing errors
- }
It seems like options2 don't completely overwrite options1. What's the best way to clear out a form's validate object data so I can pass it a whole new set of options?