If Condition NOT working..




I have a form with a number field which can't be printed if its empty or has less than or more than 12 numbers or the numbers don't start with 5300100 or 5300200, I use the code below

var a = JobCard.rawValue; // jobcard is the text field to check for more than or less than 12 numbers

Var newValueLength = a.toString().length;

Var chkLoc = a.toString().substr(0, 7);


if (newValueLength !== 12 || chkLoc !== "5300100" || chkLoc !== "5300200"){

app.alert("Invalid Value")


the above code doesn't check for empty field before printing but does check for length of the numbers entered if its not 12 and displays the print dialog box, so, if I add the code below to check for empty and null:

if (newValueLength !== 12 || chkLoc !== "5300100" || chkLoc !== "5300200" || newValueLength == 0 || newValueLength == "" ||newValueLength == null){

app.alert("Invalid Value")


the above code doesn't work at all, nothing happens and it shows the print dialogbox which it shouldn't since the JobCard field is empty, any idea, any body.

Thank You

Accepted Solutions (0)