How to Set a PDF Drop-Down Field by Export Value using Acrobat JavaScript
Question details
The user needs to use Acrobat JavaScript to select a combo box value based on its export value and dynamically populate a related text field without interfering with other drop-down menus.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or modifying interactive PDF forms where selecting a specific drop-down option automatically fills out associated text fields via scripting.
- Observed behavior
- Setting the combo box value successfully using its predefined export value and executing a separate script to populate the related text field, ensuring distinct field names prevent conflicts.
Verify that your PDF editor has advanced form preparation capabilities enabled and map out the exact names and designated export values of all your drop-down and text fields.
Use Prepare Form and JavaScript to Set Drop-Down Export Values
Assign unique names to all form fields and utilize the Mouse Up action in the Prepare Form tool to execute a JavaScript code that selects options via export values.
To dynamically control form fields in a PDF, referencing an item's export value rather than its display name ensures script accuracy. This is especially useful in complex forms where multiple items might look similar.
A common pitfall is duplicating field names; you must ensure every drop-down and text field has a completely unique name so that changing one field does not unintentionally overwrite another.
Launch your PDF document and open the 'Prepare Form' tool from the right-hand pane to enter form editing mode.
Double-click each drop-down and text field to open their Properties. Under the 'General' tab, ensure every field has a distinct, non-duplicated name.
In the drop-down Properties, go to the 'Options' tab. Verify that each list item has the correct 'Export Value' assigned to it.
Navigate to the 'Actions' tab of the drop-down field. Choose 'Mouse Up' from the Select Trigger menu, select 'Run a JavaScript' from the Select Action menu, and click 'Add'.
In the JavaScript Editor, enter the code: this.getField("Dropdown1").value = "B"; (Replace "Dropdown1" with your field's exact name and "B" with your target export value). Use a separate line like this.getField("Text1").value = "Details"; to populate the related text field.

Fill and Edit PDF Forms Easily with WPS PDF
While complex JavaScript actions handle advanced logic, day-to-day PDF form management doesn't require scripting. WPS Office provides an intuitive, lightweight interface to quickly fill drop-downs, type into text fields, and interact with PDF forms flawlessly.
- 1. Open the Form in WPS PDF: Launch WPS Office and open your interactive PDF document containing drop-down menus and text fields.
- 2. Interact with Fields: Click directly on any highlighted drop-down field to display its options and select the desired value without writing code.
- 3. Fill Text Areas: Navigate to any related text field and simply type your information into the active box.
- 4. Save the Completed Form: Click 'Save' or press Ctrl+S to securely save your completed PDF form locally or to your cloud storage.

Frequently Asked Questions
Why does changing one drop-down field automatically change another?
This happens when two or more form fields are assigned the exact same name in their Properties. To fix this, open the Prepare Form tool and rename each drop-down field so they are entirely unique.
What is the difference between an item name and an export value in a PDF drop-down?
The item name is the text that the user visually sees and selects in the drop-down list. The export value is the hidden, underlying data used by scripts or exported data files when that specific item is chosen.
Why is my Acrobat JavaScript not populating the related text field?
The script may be failing due to a typo in the field name, incorrect capitalization, or because the trigger event (such as Mouse Up or On Blur) hasn't fired correctly. Ensure the field name in your script exactly matches the field name in the PDF Properties.
Can I set multiple text fields based on one drop-down selection?
Yes. Within the same JavaScript action triggered by the drop-down selection, you can add multiple lines of code (e.g., this.getField("Text1").value = "Value1"; this.getField("Text2").value = "Value2";) to populate as many related fields as needed.




