Add Export Values to Acrobat PDF Dropdown Items with JavaScript
Question details
The user wants to populate an Acrobat PDF dropdown with displayed labels and separate export values using JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form dropdown needs to show readable item labels while storing corresponding export values.
- Observed behavior
- Each dropdown item should display its label and use its paired value when the form data is exported.
Open the PDF in Acrobat and use Prepare a form to check that the dropdown field exists and note its exact field name. The example below uses a dropdown named Month and a button to run the script.
Set Dropdown Labels and Export Values with Acrobat JavaScript
Use a two-dimensional array with setItems when each visible dropdown label needs a different export value.
In Acrobat, open the PDF and select All tools > Prepare a form. Select the dropdown and check its field name in Properties.
In Prepare a form, add or select a button. Open its Properties, choose the Actions tab, select Mouse Up as the trigger and Run a JavaScript as the action, then click Add.
In the JavaScript editor, enter: this.getField("Month").setItems([["January", "01"], ["February", "02"], ["March", "03"]]); Replace Month with the exact name of your dropdown field, then save the action.
Close form editing, click the button to run the script, and open the dropdown. Select an item and check the exported form data to verify its value.

Work with PDFs and Office Files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility makes it easier to move existing files into your workflow. Use Acrobat for the specific JavaScript form action described above.

Frequently Asked Questions
How do I give a dropdown item a different export value?
Pass setItems an array of pairs, such as [["January", "01"]]. The first string is the displayed label; the second is the export value.
Where do I find the dropdown field name?
In Acrobat, open All tools > Prepare a form, select the dropdown, and open its Properties. Use the exact field name in this.getField().
Where can I add the JavaScript in Acrobat?
One option is a button action: in Prepare a form, open the button's Properties, select Actions, and add a Run a JavaScript action for the Mouse Up trigger.
Does setItems add to the existing dropdown list?
No. setItems replaces the dropdown's current items with the items in the supplied array. Include every item you want in the resulting list.




