How to Populate an Acrobat Drop-Down List from Multiple Other Lists
Question details
The user needs to create a dynamic drop-down list in a PDF form where the available options are generated from selections made in two other drop-down fields.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating advanced interactive PDF forms that require conditional logic and dynamic data.
- Observed behavior
- A third drop-down list needs to dynamically update its items using JavaScript whenever the user changes the selections in the first two source drop-down fields.
Ensure you have Adobe Acrobat Pro installed, as standard Adobe Reader does not support creating or editing JavaScript within PDF form fields. You will also need a basic understanding of JavaScript arrays and Acrobat API methods.
Using a Custom Calculation Script in Adobe Acrobat
Apply a custom JavaScript calculation script to the target drop-down field to read, process, and combine values from the source fields.
To make a drop-down list dynamic, you must attach a calculation script to the target field. This script will trigger every time the source fields are updated, gathering their current values and assigning them as options to the third field.
Open your PDF form in Adobe Acrobat Pro and select 'Prepare Form' from the Tools menu to enter editing mode.
Right-click the third (target) drop-down field, select 'Properties', and navigate to the 'Calculate' tab.
Select the 'Custom calculation script' option and click the 'Edit' button to open the JavaScript editor window.
Enter JavaScript code to read the source fields using `this.getField("Field1").valueAsString` and `this.getField("Field2").valueAsString`. Combine these values into an array, ensuring you exclude any empty or duplicate values.
At the end of your script, use the `setItems(yourArray)` method on the target field object to populate the drop-down list with the dynamically generated array.
Click 'OK' to save the script, close the properties dialog, and exit 'Prepare Form' mode to test the drop-down fields' interaction.

View and Manage Interactive PDF Forms with WPS Office
While creating complex JavaScript-based dropdowns requires Adobe Acrobat Pro, WPS Office offers a highly efficient, free alternative for opening, filling out, and managing interactive PDF forms. It is an all-in-one suite that handles your daily document needs seamlessly without a heavy subscription.
- 1. Install WPS Office: Download and install the free WPS Office suite on your computer or mobile device.
- 2. Open Your PDF Form: Launch WPS PDF and open your interactive PDF document.
- 3. Fill Out the Form: Click directly on the interactive form fields, including drop-down lists, to input your data seamlessly.
- 4. Save and Export: Use the save icon or export options to securely save your filled-out PDF form to your local drive or cloud storage.

Frequently Asked Questions
Why isn't my PDF JavaScript working when opened in Chrome or Edge?
Most modern web browsers use lightweight, built-in PDF viewers that do not support advanced Acrobat JavaScript features like `setItems()`. For dynamic scripts to function properly, the end-user must open the form in dedicated PDF software like Adobe Acrobat or Adobe Reader.
How do I prevent duplicate values from appearing in the third drop-down list?
Within your custom calculation script, you can use a JavaScript array filtering loop or a `Set` object to check for and remove duplicate string values before passing the final cleaned array into the `setItems()` method.
Can I populate a PDF drop-down list from an external database?
Standard PDF JavaScript cannot directly query external SQL databases due to strict security sandboxing. To achieve similar functionality, you must hardcode the data arrays within document-level JavaScript, or use external data objects (ADO) which are restricted to specific trusted enterprise environments.




