How to Populate an Acrobat Dropdown Based on a Text Field Value
Question details
The user wants to use JavaScript in an Adobe Acrobat PDF form to automatically update or populate a dropdown menu when a specific value (like a bus number) is entered into a text field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating dynamic, interactive PDF forms where the options or selected values in a dropdown menu change based on the user's text input.
- Observed behavior
- The PDF form requires a validation script to read the text field's input, map it to predefined ranges, and accurately set the corresponding dropdown item.
Ensure you have access to the 'Prepare Form' tool in Adobe Acrobat Pro and finalize all your form field names before writing the script, as JavaScript relies on exact field name references.
Use a Validation Script on the Text Field
Add custom JavaScript code to the text field's validation event to check the entered value and automatically update the target dropdown.
By using the Validate event, Acrobat will run your script the moment the user finishes typing and tabs out of the text field. The script will compare the input against predefined ranges and update the dropdown accordingly.
Open your PDF in Adobe Acrobat, navigate to the Tools menu, and select the 'Prepare Form' tool.
Right-click the specific text field (e.g., the bus number input field) and choose 'Properties' from the context menu.
Navigate to the 'Validate' tab, select the 'Run custom validation script' option, and click the 'Edit' button.
Write your JavaScript to evaluate the input and set the dropdown value. For example: if the event value is between 1991 and 1993, use getField('YourDropdownName').value = '1990 MCI'.
Click 'OK' to save your script. Exit the Prepare Form mode and test the text field with valid, invalid, and blank inputs to ensure the dropdown updates correctly.

Create and Manage Interactive PDF Forms with WPS Office
For users who need an intuitive way to handle PDFs, WPS Office offers a comprehensive PDF editor. You can easily fill out interactive forms, edit text, and manage your documents smoothly without dealing with complex coding environments.
- 1. Open WPS Office: Launch WPS Office on your computer and navigate to the PDF module to open your document.
- 2. Access Form Tools: Click on the 'Form' tab in the top ribbon to view all available interactive form filling options.
- 3. Fill or Edit Fields: Click directly into the text fields, checkboxes, or dropdown menus to fill out the form seamlessly.
- 4. Save and Share: Once your form is complete, quickly save the PDF and share it directly with your team.

Frequently Asked Questions
Why isn't my JavaScript updating the PDF dropdown?
Check if the field names in your script exactly match the names in your form properties. Acrobat JavaScript is case-sensitive, so 'Dropdown1' and 'dropdown1' are treated as completely different fields.
Will this Acrobat form JavaScript work on mobile devices?
Not all PDF JavaScript functions work on mobile PDF readers. Many third-party mobile apps strip out or ignore custom JavaScript for security and performance reasons. It is highly recommended to test the form thoroughly on target mobile devices.
Can I hide or show fields based on a dropdown selection?
Yes, you can use JavaScript in the dropdown field's Keystroke or Validate event to change the display property of other fields. For example, setting a field's display property to 'display.hidden' or 'display.visible' based on the selected value.




