Answered
Hi:
I need some help with IF and ELSE and then showing it on a TEXT in the Adobe forms. Can you please help?
What I am trying to do? There is a SummaryValue (a TEXT FIELD) with a number. Based on the value in the SummaryValue, I want a TEXT field to show comments.
If the SummaryValue is between 0 to 0.3 THEN show "Value less than 30"
If the SummaryValue is between 0.3 to 0.38 THEN show "Value betn 31 to 38"
If the SummaryValue is >0.39 THEN show "Value more that 39"
Any help is appreciated.
For example, to get the value of a form field in an AcroForm, as opposed to a LiveCycle Designer form, use this code.
var nVal = this.getField("SummaryValue").value;
Then to impliment the first "if" statement use this code:
if( (nVal >= 0) && (nVal <= 0.3) )
this.getField("CommentField").value = "Value is less than 30";
The rest of the if/else structure follows a similar pattern. When it comes to programming the details are particularly important. You should have a book on Core JavaScript to help you out in this area (the O'Reilly book is my favorite).
There's gobs of information about JavaScript on the web. But you have to be careful about what you read. There's Core JavaScript, which is just the basic JavaScript language. Then there are the JavaScript models for different applications. Most of the information out there is related to Browser Scripting, not Acrobat. You can find videos and info specifically about Acrobat JavaScript on this site and at www.pdfscripting.com.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script