3 Replies Latest reply on Aug 5, 2015 4:49 AM by try67

    Need assistance writing a JavaScript code for validating the length of transit numbers

    brettp97376117

      var transit = this.getField("bankNumber").valueAsString;

      var transitLength = transit.length;

      if (transit.length !===  5)

      {

      xfa.host.messageBox("The transit number has to be 5 digits.")

      }

       

      I'm using Adobe proffesional 7.0, as I'm not allowed to update to a newer version for compatibility reasons.

       

      This code won't even run, I'm not sure why, and it is under the validate event heading.

       

      I am new to JavaScript so I could be making a really silly error.

       

      -Brett

       

      As a side note the object of this code is to alert the user that the transit number is not 5 digits. All banks here in Canada have 5 digit transit numbers.