Skip to main content
Known Participant
April 20, 2019
Question

Error in Javascript lookup for Acrobat Pro 10

  • April 20, 2019
  • 2 replies
  • 667 views

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

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
April 20, 2019

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

Known Participant
April 20, 2019

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

Bernd Alheit
Community Expert
Community Expert
April 20, 2019

You must use:

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

Known Participant
April 20, 2019

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.