These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Debugger Bugging Me

jrenee97045
Registered: Mar 29 2010
Posts: 25
Answered

Okay...so I ran this script through the debugger and everything brings a result, but when I copy and paste to the calculate tab's javascript, it keeps giving me an error. Can anyone see the problem? I'm a novice, and I'm trying to learn javascript through trial and error using the debugger.

if (this.getField("FS1").value> “7200”
event.value = 208.75;
else if (this.getField("FS1").value> “3600”
event.value = 154.30;
else if (this.getField("FS1").value> “2000”
event.value = 136.15;
else if (this.getField("FS1").value> “0”
event.value = 99.85;
else
event.value = “”;

Thanks,
Renee

My Product Information:
Acrobat Pro 9.3.1, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi jrenee97045,

The tutorial on writing conditional statements linked below might be helpful. Running each line of code in the debugger separately I see that missing ) after condition and invalid syntax error messages. Your parentheses are not balanced and numerical values should not be quoted.

http://www.acrobatusers.com/tutorials/conditional-execution

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscirpting.com
www.windjack.com
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Exactly what error are you getting?

I got the following error:

Quote:
JavaScript error at line 3 : missing ) after condition
2:.Fix it?
Some of the obvious errors:

Missing trailing closing parentheses, ")", for the logical statement of the 'if' statement.
Numeric values being compared as character string values.

if (this.getField("FS1").value > 7200)event.value = 208.75;else if (this.getField("FS1").value> 3600)event.value = 154.30;else if (this.getField("FS1").value> 2000)event.value = 136.15;else if (this.getField("FS1").value> 0)event.value = 99.85;elseevent.value = "";

Dimitri has pointed you to a good resource to learn about Acrobat JavaScripting.

George Kaiser

jrenee97045
Registered: Mar 29 2010
Posts: 25
You're all great! Thank you for the feedback. It worked like a charm. I just keep learning...Thanks, again!

:)