Skip to main content
Participant
Jan 11, 2019 10:05 PM UTC
Answered

If / Else Javascript Error Acrobat XI

I am trying to get the following If/Else statement to work and keep getting the "Syntax Error: missing ; before statement 2: at line 3" error.

// Get the value of the input field, as a number

var Overall Performance Rating = this.getField("Overall Performance Rating").valueAsString);

// Set this field's value based on the input value

if (Overall Performance Rating<=1.0) {

event.value = "UnAcceptable";

} else if (Overall Performance Rating>=1.0 && Overall Performance Rating<=1.99) {

event.value = "Needs Major Improvement";

} else if (Overall Performance Rating>=2.0 && Overall Performance Rating<=2.49) {

event.value = "Some Improvement Required" ;

} else if (Overall Performance Rating>=2.50 && Overall Performance Rating<=2.99) {

event.value = "Average" ;

} else if (Overall Performance Rating>=3.0 && Overall Performance Rating<=3.49) {

event.value = "Significant Results";

} else if (Overall Performance Rating>=3.50 && Overall Performance Rating<=3.99) {

event.value = "Exceptional";

} else if (Overall Performance Rating==4.0) {

event.value = "Outstanding";

}

I trying to use the result of the text field labeled "Overall Performance Rating" to dictate the results of the text field this script is being entered in. I am now stuck with the syntax error, what am I missing? Any assistance will be greatly appreciated.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Jan 11, 2019 10:17 PM UTC

Variable names can't have spaces in them.

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Jan 11, 2019 10:17 PM UTC

Variable names can't have spaces in them.

Translate
Participant
Jan 11, 2019 11:24 PM UTC

Do'h! Darn spaces. Thanks, works fine now.

Translate