xVal ignoring fields that are hidden
Posted
by gmcalab
on Stack Overflow
See other posts from Stack Overflow
or by gmcalab
Published on 2010-03-31T18:17:58Z
Indexed on
2010/03/31
18:23 UTC
Read the original article
Hit count: 245
xval
|jquery-validate
I have a form where a user can toggle receiving funds either via check or via electronic transfer. When they choose either way in a list box, the respective part of the form hides. If they choose electronic transfer only bank info fields show, if they choose via check only address info shows and the bank fields are hidden.
Well, since they choose one way or another I want to, not validate for something that is hidden. (Client Side)
Is there a way to set xVal to only validate fields that are not visible?
I tried to override validate with the following but no dice...
$('#EditPayment').validate({
elementwhichishidden: {
required: function(element) {
return ($(element).parent().parent().css('display') != 'none');
}
}
});
© Stack Overflow or respective owner