I'm using https://jqueryvalidation.org to validate my form. Now I have an input for IBAN, which is not required, only if another field is filled. But WHEN it is required, I want to start the IBAN-Check. When it's not required, I don't want the IBAN-Check.
Here's some code:
fm_operator_iban: {
required: function(element) {
return $("#fm_operator_accountname").val().length > 0 || $("#fm_operator_bankname").val().length > 0;
},
validIBAN: {
depends: function(element) {
return "required";
}
}
}
I only need a solution for the validIBAN part. I tried something which totally didn't work. ;) Thanks!