If Condition NOT working..

Avatar

Avatar

TryllZ

Avatar

TryllZ

TryllZ

11-06-2015

Hi,

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)

Answers (2)

Answers (2)

Avatar

Avatar

radzmar

MVP

Avatar

radzmar

MVP

radzmar
MVP

11-06-2015

There a method in LiveCycle to prevent printing if a field is empty you should check out.

http://forms.stefcameron.com/2008/04/13/prevent-printing-pdf-forms-in-acrobat-8/

Avatar

Avatar

TryllZ

Avatar

TryllZ

TryllZ

12-06-2015

Sir Thank You so much, I did get the PDF file and opened it in Livecycle but I didnt find any code to check for empty field validation..any help ??