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

Syntax Error: Missing }

New Here ,
May 13, 2025 May 13, 2025

I would love some help on this one. I have used coding (Javascript) similar to this for some time now in Acrobat, but am self-taught and can't seem to understand how to fix this error. For reference, I use MS Visual Studio to write the coding, and that program is reporting no errors.

 

I am getting a syntax error in part of my code when trying to enter it into Adobe as  a Document Javascript; I have omitted the code that comes before this as it does not seem to be an issue and is a lot of code. The error I am getting is: "SyntaxError: missing } after property list". But I can see the closed bracket at the end of my code, have attempted to re-type that portion of the code, and have tried to change some of the formatting around it as well. Nothing seems to get rid of the error and I cannot complete my document without this code. The code as a whole auto-populates several form fields with information when an item is selected from a dropdown list. Any insight would be greatly apprciated.

 

function SetFieldValues(cProdChoice) {
// Populate fields with values from the ProductBeingPackaged Object
this.getField("Product").value = Package[cProdChoice].ProdName;
this.getField("IFU").value = Package[cProdChoice].ProdInstr;
this.getField("Bag").value = Package[cProdChoice].BagProd;
this.getField("Box").value = Package[cProdChoice].BoxProd;
this.getField("RegulatoryLabel").value = Package[cProdChoice].RegLab;
this.getField("BarcodeLabel").value = Package[cProdChoice].ProdBCode;
this.getField("MasterPack").value = Package[cProdChoice].ProdMP;
this.getField("MasterPackQty").value = Package[cProdChoice].QtyMP;
}

TOPICS
JavaScript , PDF forms
240
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
May 13, 2025 May 13, 2025

There is no error in the script you posted.  "I have omitted the code that comes before this as it does not seem to be an issue and is a lot of code."  The syntax error should tell you which line the error is on.  Go to that line in your script.

View solution in original post

Translate
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 ,
May 13, 2025 May 13, 2025

There is no error in the script you posted.  "I have omitted the code that comes before this as it does not seem to be an issue and is a lot of code."  The syntax error should tell you which line the error is on.  Go to that line in your script.

Translate
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 ,
May 13, 2025 May 13, 2025

The error is on the first line of the code I posted here. I omitted the code before it as the error was on this line.

 

If there is no error in the code, I am assuming it is an issue with Acrobat itself.

Translate
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 ,
May 13, 2025 May 13, 2025

Resolved. There were a few errors in my earlier code which apparently threw this error on the wrong line and for the wrong thing??? Glad I had the time to go through word-by-word to fix it, this time.

Translate
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 ,
May 13, 2025 May 13, 2025
LATEST

That's what writing code is about. Checking the details and being thorough. 

BTW: missing brackets and parentheses always indicate an error farther down in the code, because the parser can't know where an ending bracket or parenthese is supposed to be placed. That's your job. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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