0

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!

MrLumbergh
  • 63
  • 1
  • 9
  • So, you need an IBAN validator? – grooveplex Jan 19 '17 at 10:39
  • No, I have an IBAN validator. But if you put something in the input field, delete it and send the form, it has the IBAN-validation always on. Although it's not required if it's empty. ;) – MrLumbergh Jan 19 '17 at 16:34

0 Answers0