How to Update PDF Form Dropdown Fields Based on Another Selection
Question details
The user needs to dynamically update multiple PDF form dropdown fields using JavaScript based on a previous selection, and allow custom text entries within the dropdowns.

- Product
- PDF Form Editor
- Device & OS
- not provided
- Scenario
- Creating interactive PDF forms where selecting a value in one field triggers updates to the available items in other dropdown menus.
- Observed behavior
- Passing multiple field names to a single getField() call fails to update both dropdowns simultaneously because the setItems() method only applies to one field at a time.
Ensure you have a PDF editing tool that supports advanced form properties and JavaScript execution, and save a backup copy of your PDF before applying new custom calculation scripts.
Use Separate JavaScript Calls for Each Field
Update each dropdown field individually using the setItems() method, as passing multiple names at once is not supported in PDF JavaScript.
The setItems() method in PDF JavaScript only applies to a single field object at a time. If you need to update multiple dropdowns based on one action, you must retrieve and set each field individually.
Open the PDF form in editing mode, right-click the primary trigger field (the one users interact with first), and select Properties.
Navigate to the Actions or Calculate tab and choose to run a custom JavaScript when the field value changes.
Use separate lines of code for each target dropdown field. For example: this.getField("AbsenceTypeJob1Emp1").setItems([" ", "Vacation", "Sick"]); and on the next line add this.getField("AbsenceTypeJob2Emp1").setItems([" ", "Vacation", "Sick"]);.
Enable Editable Combo Boxes for Custom Text
Configure the dropdown list as an editable combo box to allow users to type their own custom text instead of being restricted to predefined options.
Create and Edit Interactive PDF Forms in WPS Office
WPS Office provides robust PDF editing capabilities, including form creation, filling, and management. You can easily insert dropdown lists, text fields, and configure advanced form properties to collect data efficiently.
- 1. Open Your PDF Document: Launch WPS Office and open the PDF file you wish to make interactive.
- 2. Access the Form Tab: Navigate to the 'Form' tab in the top ribbon menu to view the form creation tools.
- 3. Insert Form Fields: Select 'Combo Box' or 'Text Field' from the toolbar and click on the page to place the interactive element.
- 4. Configure Properties: Double-click the inserted field to open the Properties window, where you can add list items and define field behavior.

Frequently Asked Questions
Why isn't my PDF dropdown showing the custom entered text?
Ensure that the dropdown field is set up as a combo box. You must check the 'Allow user to enter custom text' option in the Options tab of the field properties to enable manual typing.
Can I pass an array of field names into getField() to update them all at once?
No, standard PDF JavaScript requires you to call getField() for each specific field individually. The setItems() method will only apply to the single field object retrieved by that specific call.
How do I mirror a dropdown selection into a separate text field?
You can add a custom calculation script to the target text field properties. Use the code: event.value = this.getField("YourDropdownName").valueAsString; to pull the selected value from the dropdown.




