How to Filter PDF Drop-Down Items Based on Other Fields
Question details
The user wants to configure a PDF form so that the available options in a drop-down menu are dynamically filtered and updated based on the values entered in a different source field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form or table where users should only select items (like sample numbers) that are directly associated with the data they entered in preceding fields.
- Observed behavior
- By default, PDF drop-down lists remain static; the goal is to implement custom logic to dynamically rebuild the dependent list items whenever the source field changes.
Ensure you have access to a professional PDF editor with JavaScript form support. Back up your original PDF form document before adding or editing any custom scripts.
Use Acrobat JavaScript to Create Dependent Drop-Downs
Add a custom JavaScript calculation script to your target drop-down field to dynamically update its available items based on the value selected in the source field.
Interactive PDF forms rely on Acrobat JavaScript to handle complex conditional logic. By inspecting the value of a source text field or drop-down menu, you can programmatically clear and populate a target drop-down field with matching context-specific items.
It is highly recommended to assign clear and unique names to all your form fields. This ensures the script references the correct data components without conflict and prevents invalid selections when values change.
Open your PDF document in your PDF editor (e.g., Adobe Acrobat Pro) and navigate to the 'Prepare Form' tool from the right pane or the Tools menu.
Right-click your source field and target drop-down field, select 'Properties', and give them clear, identifiable names in the 'General' tab (e.g., 'SourceField' and 'TargetDropdown').
Open the Properties for your source field, navigate to the 'Options' tab, and check the box for 'Commit selected value immediately' so changes trigger updates instantly.
Open the Properties of the target drop-down field, navigate to the 'Calculate' tab, select the 'Custom calculation script' option, and click the 'Edit' button.
In the JavaScript editor, enter code that retrieves the source field's value using `var sourceVal = this.getField("SourceField").value;`, evaluates it with an `if` or `switch` statement, and updates the target using `this.getField("TargetDropdown").setItems(["Option 1", "Option 2"]);`.
Click 'OK' to close the script editor, exit the form preparation mode, and change the value in your source field to verify that the dependent drop-down list updates properly.

Easily Manage and Fill Interactive PDF Forms with WPS Office
While adding complex JavaScript to PDF forms requires specialized editor software, WPS Office provides a powerful, lightweight PDF tool to easily view, fill, and manage these interactive forms. WPS PDF ensures seamless compatibility for all standard PDF forms without the steep subscription fees.
- 1. Download and Install WPS Office: Visit the official WPS Office website to download the installer and complete the setup on your device.
- 2. Open Your Interactive PDF: Launch WPS Office, select the 'PDF' tab, click 'Open', and browse your computer to select the PDF form file.
- 3. Fill Fields and Drop-Downs: Click directly into the highlighted form fields. Use the integrated drop-down menus to make your selections, as the JavaScript logic will operate smoothly in the background.
- 4. Save the Completed Form: Once all required fields are filled out, go to 'Menu' > 'Save As' to export your completed form while retaining all inputted data.

Frequently Asked Questions
Can I create dependent drop-down lists in a free PDF reader?
No, creating dynamic dependent drop-down lists requires programming custom JavaScript into the form's calculate properties, which can only be done using a professional PDF editor. However, standard free PDF readers can use and interact with these fields after they have been set up.
Why is my dependent PDF drop-down not updating when the source field changes?
This commonly happens if the source field is not configured to commit its value instantly. You must open the source field's properties, go to the Options tab, and check 'Commit selected value immediately'. It can also occur if the field calculation order in your PDF is set incorrectly.
Can I link my PDF drop-down menus to an external Excel database?
Standard PDF forms cannot dynamically pull live data directly from an external Excel database or web server for a drop-down list due to strict security sandbox restrictions. All dependent choices must be hardcoded as arrays within the PDF document's JavaScript.
What happens to the drop-down logic if I rename the source form field?
If you rename the source field, your custom calculation JavaScript will break because it relies on the exact string name previously used (e.g., `this.getField("OldName")`). You must manually update your JavaScript code to reference the newly assigned field name.




