Copy link to clipboard
Copied
I am greating a form with a score rating for work. ex. If the dollar amount is lower then $5000 then its rated a 1, if its between $5000 & $25000 its a 2, if its above $25000 its a 3. I am currently getting an error stating "SyntaxError: syntax error 1: at line 2." Can someone please help me and let me know what is wrong with my code?
if (DH3 >= 1.00) && (DH3 < 5000.00)) {
event.value = "1";
}
else if (DH3 >= 5000.00) && (DH3 < 25000.00)) {
event.value = "2";
}
else if (DH3 >= 25000.00) && (DH3 < 100000.00)) {
event.value = "3";
}
Copy link to clipboard
Copied
You are missing a parenthesis in your if statements:
if ((DH3 >= 1.00) && (DH3 < 5000.00)) {
event.value = "1";
}
else if ((DH3 >= 5000.00) && (DH3 < 25000.00)) {
event.value = "2";
}
else if ((DH3 >= 25000.00) && (DH3 < 100000.00)) {
event.value = "3";
}
Copy link to clipboard
Copied
Thank you! The error went away but its not calculating for me. Is there something I am doing wrong?
Copy link to clipboard
Copied
Have you defined DH3 somewhere else?
Copy link to clipboard
Copied
No I have not.
Copy link to clipboard
Copied
What is DH3 supposed to be? A value from another field? You would need to define what DH3 is in your script.
Copy link to clipboard
Copied
In addition to all the correct remarks given above, you really need to add a default else command at the end of the code, in case the value is smaller than 1, larger than 100,000, or empty.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now