SyntaxError: syntax error 6: at line 7 (multiple condition statement)

New Here ,
Jul 23, 2019

Copy link to clipboard

Copied

I have a pdf that contains three fields. One is a text field in which dollar amount is entered, the second is a text field in which a term is entered (i.e., 36, 48, 60) and the last field is the one in which the solved amount will be listed. An example of this formula is if Cost of Licenses >$25,000; multiple the entered amount * .03081 if  FinanceTerm = 36.

I'm getting the following error message: SyntaxError: syntax error 6: at line 7. I'm very new to multiple options and can't figure out what I'm missing. Any help is appreciated.

var A = this.getField("CostofLicenses").value; // the value of field A;

var B = this.getField("FinanceTerm").value; // the value of field B;

var C = this.getField("MonthlyPayment").value; // the value of field C;

event.value = "";

if(A>$24,999,B=="36"){event.value=A*.03081};

else if(A<$25,000,B=="36"){event.value=A*.03110};

else if(A>$24,999,B=="48"){event.value=A*.02383};

else if(A<$25,000,B=="48"){event.value=A*.02386};

else if(A>$24,999,B=="60"){event.value=A*.01962};

else if(A<$25,000,B=="60"){event.value=A*.01972};

TOPICS
Acrobat SDK and JavaScript, Windows

Views

99

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Jul 23, 2019
Bernd Alheit Adobe Community Professional , Jul 23, 2019
Remove the ; after }

Likes

Translate

Translate
Jump to answer Jump to answer
Most Valuable Participant ,
Jul 23, 2019

Copy link to clipboard

Copied

if(A>$24,999,B=="36")

just isn't right. You use && or || according to the condition you want.

JavaScript Comparison and Logical Operators

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Jul 23, 2019

Copy link to clipboard

Copied

Also, remove the "$" symbol and the commas from the numbers.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jul 23, 2019

Copy link to clipboard

Copied

Thank you. I initially and the && and changed it to a comma after watching a video on line.

Get Outlook for iOS<https://aka.ms/o0ukef>

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jul 23, 2019

Copy link to clipboard

Copied

I updated the recommended changes and am now getting a syntax error 6 at line 7

else if(A>24999 && B=="48"){event.value=A*.02383}; - am I missing a space in there?

I appreciate the help.

var A = this.getField("CostofLicenses").value; // the value of field A;

var B = this.getField("FinanceTerm").value; // the value of field B;

var C = this.getField("MonthlyPayment").value; // the value of field C;

event.value = "";

if(A>24999 && B=="36"){event.value=A*.03081};

else if(A<25000 && B=="36"){event.value=A*.03110};

else if(A>24999 && B=="48"){event.value=A*.02383};

else if(A<25000 && B=="48"){event.value=A*.02386};

else if(A>24999 && B=="60"){event.value=A*.01962};

else if(A<25000 && B=="60"){event.value=A*.01972};

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jul 23, 2019

Copy link to clipboard

Copied

Remove the ; after }

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more