That code you wrote should work just fine. Just try it! See also http://docs.jquery.com/Plugins/Validation/rules
On Tue, Feb 10, 2009 at 9:32 AM, stej <cerna.ze...@seznam.cz> wrote: > > In some cases I need not to validate some fields. E.g. If I check some > checkbox new inputs with further options are shown. These inputs > should be validated when submitting form. If I uncheck the checkbox no > options are needed and they disappear (they should not be validated). > It's clear. > > My problem is how to remove them from validation. I could remove the > rules on "change" on the checkbox, but I don't know the rules on > inputs because they are generated. So is it possible to remove somehow > the rules (when unchecking the checkbox) and set them back again > (after checking the checkbox). > > E.g. > inputRules = jQuery("#someInput").rules(); // gets the rules > jQuery("#someInput).rules("remove"); // and removes the rest (the > two rows are equal to "pop") > > //but how to put them back? > jQuery("#someInput).rules("add", inputRules); // "sets" the rules > > Is it possible somehow? >