• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

If / Else Javascript Error Acrobat XI

New Here ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

97

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jan 11, 2019 Jan 11, 2019

Variable names can't have spaces in them.

Likes

Translate

Translate
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

Variable names can't have spaces in them.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

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