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

Undefined type error using JS object get value by key variable, and JSON source file(s) inquiry

Engaged ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Has anyone by chance experienced an undefined type error using JS object get value by key variable that requires the square bracket notation? On another note, in contemplating using JSON in an Acroform, is it advisable to download the JSON source code and place any of the JSON files in the Acrobat Javascripts folder and if so which which source files? Thank you ahead of time.   

TOPICS
How to , JavaScript , PDF forms

Views

1.3K

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

The "undefined" error just means that a variable (or property) used with object notation is undefined, so the notation makes no sense.

 

Do not use external JSON source code in Acrobat unless you understand exactly what it is you are doing. 

 

 

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

Votes

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
Engaged ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

In response to 'The "undefined" error just means that a variable (or property) used with object notation is undefined, so the notation makes no sense. Understood but I really don't believe you understood the question. In response to 'Do not use external JSON source code in Acrobat unless you understand exactly what it is you are doing', if u r going to be presumptuous with a hint of arrogance in fielding a question, please refrain from answering as your response was certainly not helpful. 

Votes

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 ,
Dec 06, 2022 Dec 06, 2022

Copy link to clipboard

Copied

LATEST

I understand perfectly.  No code was provided so I couldn't point out the exact issue, but my answer is on point. A variable with an undefined value was used with object notation, which resulted in the error. The fix is to test the variable before using it to acquire another value.  This is a very common issue. 

 

About JSON. The current version of Acrobat DC already contains a JSON object. So there is no reason to include code that defines a JSON object. Because of this, trying to include code that redefines the JSON object could be problematic.  And of course there is no reason to do it.  In your use case the actual JSON format is not important, since it's only used to save and restore data on the document. So the older methods of converting data objects to and from text are suitable for this purpose. Hence my comment about being careful, cause what you are asking about is both risky and unnecessary. 

 

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

Votes

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

What script does you use?

Votes

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