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
01-Sep-2014I 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( ... );
});