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

Error in Javascript lookup for Acrobat Pro 10

Community Beginner ,
Apr 20, 2019 Apr 20, 2019

Copy link to clipboard

Copied

I have input a script for a field to fill in 3 others depending on the value entered in one. I keep getting an error saying syntax error ) is missing after condition 1 in line 2.

Here is the script. I have tried placing a second ), but that is not working.I am missing sometthing, but can't figure it out.

if (Player 1 Lvl.value=="1") { 

   this.getField("Player 1 Multiple 1").value = "1"; 

    this.getField("Player 1 Multiple 2").value = "2");

    this.getField("Player 1 Multiple 3").value = "3");

if (Player 1 Lvl.value=="2") { 

    this.getField("Player 1 Multiple 1").value = "2"; 

    this.getField("Player 1 Multiple 2").value = "3");

    this.getField("Player 1 Multiple 3").value = "4");

if (Player 1 Lvl.value=="3") { 

    this.getField("Player 1 Multiple 1").value = "3"; 

    this.getField("Player 1 Multiple 2").value = "4");

    this.getField("Player 1 Multiple 3").value = "5");

}}} else if (Player 1 Lvl.value =="") { 

    this.getField("Player 1 Multiple 1").value = ""; 

    this.getField("Player 1 Multiple 2").value = "");

    this.getField("Player 1 Multiple 3").value = "");

Thank you for any help or insight you can give me.

Regards,

Larry Whalen

TOPICS
Acrobat SDK and JavaScript , Windows

Views

350

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
Community Expert ,
Apr 20, 2019 Apr 20, 2019

Copy link to clipboard

Copied

You must use:

   this.getField("Player 1 Lvl").value

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
Community Beginner ,
Apr 20, 2019 Apr 20, 2019

Copy link to clipboard

Copied

I thought that was the first statement I am using in the script.

if (Player 1 Lvl.value=="1")

then I want it to return the values below in the other fields. Or do I have to put this in for each line.

{

   this.getField("Player 1 Multiple 1").value = "1";

    this.getField("Player 1 Multiple 2").value = "2");

    this.getField("Player 1 Multiple 3").value = "3");

Thanks for the prompt reply.

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
Community Expert ,
Apr 20, 2019 Apr 20, 2019

Copy link to clipboard

Copied

You have a lot of errors in this code. The one Bernd pointed out, plus incorrect use of curly brackets, if-else and parentheses.

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
Community Beginner ,
Apr 20, 2019 Apr 20, 2019

Copy link to clipboard

Copied

LATEST

Thank you everyone. I went into the code and rewrote it. It is now working correctly. I had so many things I missed on this, but have now fixed it.

Thank you for all your help.

Regards,

Larry

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