Home > DeveloperSection > Forums > How to enable and disable Required Validation group for fields and Expressions fields when a div is shown
Ankit Singh

Total Post:341

Points:2389
Posted on    August-31-2014 11:53 PM

 C#
Ratings:


 1 Reply(s)
 646  View(s)
Rate this:

I have a credit card transaction area in my form that I hide and show based on user's selection in an radio button group. 

With my credit card piece are required validations and required expressions that is in a validation group. 

I was wondering if I could get some help with enabling and disabling this validation group in JQuery. 

Thanks in advance.



Sumit Kesarwani

Total Post:378

Points:2694
Supported
Posted on    September-01-2014 12:27 AM

I usually have a class that indicates whether a field should be validated or not, so when a field that should be validated is hidden, just remove the class. Add it again when it is displayed.

A more elegant solution is to disable validation of hidden fields:

$('myform').submit(function() {

    $('myform').find('validate:visible').forEach( ... );

});


Don't want to miss updates? Please click the below button!

Follow MindStick