How to Link PDF Dropdown Fields with JavaScript in Adobe Acrobat
Question details
The user needs to link multiple dropdown fields (such as Wood, Sorting, and Sizes) in a PDF order form so that selecting an option in one dynamically updates the available choices in the others.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating a dynamic and interactive PDF order form with dependent dropdown menus.
- Observed behavior
- The current JavaScript code fails to execute, preventing the dependent dropdown fields from updating based on the primary dropdown selection.
Ensure you have access to Adobe Acrobat's form editing tools (Prepare Form mode) and basic knowledge of adding custom JavaScript. Always save a backup copy of your PDF document before modifying underlying scripts.
Update the Variable in the Custom Validation Script
Fix the dropdown script by placing it in the custom validation area and replacing the incorrect value.change variable with event.value.
When writing JavaScript for Adobe Acrobat form fields, using the correct event variable is crucial for triggering updates. The variable event.value correctly captures the data the user just selected, making it the proper trigger for dynamically updating dependent fields using the setItems() method.
Placing the script in the Validation tab rather than the Action tab ensures the changes register immediately upon selection.
Open your PDF file in Adobe Acrobat, navigate to the Tools menu, and select Prepare Form.
Right-click the controlling or primary dropdown field (e.g., the 'Wood' field) and select Properties from the context menu.
In the Properties dialog box, click on the Validate tab, then select the option 'Run custom validation script'.
Click the Edit button. In the JavaScript editor, find your switch statement and change 'switch (value.change)' to 'switch (event.value)'.
Ensure you are using the setItems() method inside the switch cases to populate the dependent fields. Click OK to save the script, then exit Prepare Form mode to test your updated dropdowns.

Manage and Edit PDF Forms Seamlessly with WPS Office
While advanced JavaScript programming for dynamic forms in Adobe Acrobat may require expensive professional software, WPS Office provides a free, lightweight, and comprehensive suite for your daily document and PDF needs. Easily view, fill, and manage PDF forms alongside your Word, Excel, and PowerPoint files.
- 1. Download the Installer: Visit the official WPS Office website and download the correct installer for your operating system.
- 2. Install WPS Office: Run the downloaded installer file and follow the on-screen instructions to complete the setup.
- 3. Open Your PDF: Launch WPS Office, open your PDF form, and easily view, manage, or fill out standard form fields.

Frequently Asked Questions
Why is my PDF JavaScript not updating the dependent dropdown fields?
This usually happens if the script is placed in the wrong trigger event or uses incorrect variables. Ensure your script is located in the custom validation script area of the controlling field and utilizes 'event.value' instead of 'value.change'.
What is the difference between event.value and value.change in Acrobat?
'event.value' captures the newly selected value immediately during the validation phase, making it ideal for triggering dependent field updates. 'value.change' is often undefined or not applicable in this specific validation context, causing the script to fail.
Can I use setItems() to populate multiple dependent dropdowns at once?
Yes, you can use the setItems() method within your JavaScript switch statement to dynamically assign an array of options to multiple dependent dropdown fields based on a single primary selection.
Where do I add custom JavaScript in a PDF form field?
In Adobe Acrobat, enter the Prepare Form mode, right-click the field to open its Properties, navigate to the Validate tab (or Actions tab, depending on the script's purpose), and select the option to run a custom JavaScript.




