PDF Editing Issues

How to Update PDF Form Dropdown Fields Based on Another Selection

Huma Ashraf ChHuma Ashraf Ch Nov 5, 2026 869 views

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.

How to Update PDF Form Dropdown Fields Based on Another Selection
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.
Before you start

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.

Solution 1Recommended

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.

1
Access Trigger Field Properties

Open the PDF form in editing mode, right-click the primary trigger field (the one users interact with first), and select Properties.

2
Add Custom JavaScript

Navigate to the Actions or Calculate tab and choose to run a custom JavaScript when the field value changes.

3
Write Individual getField Calls

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"]);.

Script Validation: Test the script by interacting with the primary field to ensure both secondary dropdowns update their list items properly.
Interactive PDF Forms

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. 1. Open Your PDF Document: Launch WPS Office and open the PDF file you wish to make interactive.
  2. 2. Access the Form Tab: Navigate to the 'Form' tab in the top ribbon menu to view the form creation tools.
  3. 3. Insert Form Fields: Select 'Combo Box' or 'Text Field' from the toolbar and click on the page to place the interactive element.
  4. 4. Configure Properties: Double-click the inserted field to open the Properties window, where you can add list items and define field behavior.
Easily create and manage interactive PDF form fieldsConfigure dropdown lists and combo boxes with custom optionsFully compatible with standard PDF format forms used in Microsoft Office and AdobeLightweight interface for quick document adjustments
QA img-9

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.