Skip to main content
Participant
January 14, 2022
Answered

SyntaxError: invalid property id

  • January 14, 2022
  • 1 reply
  • 2273 views

I have tried to find what the invalid property id error is, and i can't find what it is.  I copied and pasted this directly from the article "Changing another field with combo box (drop down) selction". I renamed and deleted the email (i don't need it) and then put in the information i needed for my form.  No matter what i have tried I keep getting the same error on the same line

           SyntaxError: invalid property id 4: at line 5 - it was originally on line 4, so i tried replacing the : with a = sign and then going back and deleting the = and putting back the :.  It worked for that line, but it won't for Line 5. 

            I have attached a screen shots of the script that i am trying to use, and the information in the form.

 

Thank you in advanced for any help. 

This topic has been closed for replies.
Correct answer Thom Parker

Property ID's for an object cannot contain spaces or other punctuation unless they are enclosed in quotes.

for example

var oTest = {First Name:"Larry"}  // Incorrect, will cause syntax error

var oTest = {"First Name":"Larry"} // Correct, ID containing space is quoted

var oTest = {FirstName:"Larry"}  // Also Correct because ID does not contain a space

 

 

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 15, 2022

Property ID's for an object cannot contain spaces or other punctuation unless they are enclosed in quotes.

for example

var oTest = {First Name:"Larry"}  // Incorrect, will cause syntax error

var oTest = {"First Name":"Larry"} // Correct, ID containing space is quoted

var oTest = {FirstName:"Larry"}  // Also Correct because ID does not contain a space

 

 

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