Skip to main content
Ryan_Oliver_02445
Known Participant
December 8, 2018
Answered

How to find a field variable for Java-Script?

  • December 8, 2018
  • 1 reply
  • 519 views

Good evening, we are trying to find the specific name of a form field so that we can make changes to them.

We have tried using the traditional, "Text field name" but that doesn't seem to work much.  This is the code that we have so far

if (field.variable == "TX"){

    console.log("help!")

}

All of our code is right, except for for the form field name.

Any help would be appreciated!

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

First, I would suggest watching the videos here:

Free Video Content & Full Listing of Available Videos

They'll explain that while core JavaScript is the same everywhere, each program it is integrated into is has a different Document Object Model. The Acrobat DOM is significantly different from the Browser (i.e. web page) DOM. 

The code you've listed above is for a Web Browser and will not work in a PDF Form. 

Please refer to the Acrobat JavaScript Reference for details.

Acrobat DC SDK Documentation

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
December 8, 2018

First, I would suggest watching the videos here:

Free Video Content & Full Listing of Available Videos

They'll explain that while core JavaScript is the same everywhere, each program it is integrated into is has a different Document Object Model. The Acrobat DOM is significantly different from the Browser (i.e. web page) DOM. 

The code you've listed above is for a Web Browser and will not work in a PDF Form. 

Please refer to the Acrobat JavaScript Reference for details.

Acrobat DC SDK Documentation

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