Copy link to clipboard
Copied
When using this script I get the error message when I enter in like 3 of the nine numbers I need,
But if i do put in the afterward the 9 numbers the error message does not go away it stays. Also I tried using <= this ths a value reference in Javascrpt am I doing this wrong
Bank_Routing_number is formated as number
var cNumString = this.getField("Bank_Routing_Number").valueAsString;
if (cNumString < 9) event.value = " ";
else event.value = "Bank Routing Number Must be 9 Characters";
Help would be appricated
Copy link to clipboard
Copied
A string can't be compared to a number. You need to convert it to a number first, like this:
if (Number(cNumString) < 9) event.value = " ";
Copy link to clipboard
Copied
Sorry, that's not actually the issue in your case. In second look I think the problem is you're comparing the value itself, instead of its length. So use this code, instead:
if (cNumString.length < 9) event.value = " ";
Copy link to clipboard
Copied
U.S. bank routing numbers on include a self checking number. This can be used to verify that it is a valid number.