Skip to main content
Participant
January 11, 2019
Answered

If / Else Javascript Error Acrobat XI

  • January 11, 2019
  • 1 reply
  • 483 views

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 has been closed for replies.
Correct answer try67

Variable names can't have spaces in them.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 11, 2019

Variable names can't have spaces in them.

Participant
January 11, 2019

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