PDF Editing Issues

How to Populate a PDF Dropdown from Two Other Dropdowns

John WilsonJohn Wilson Nov 3, 2026 869 views

Question details

The user wants to dynamically update the available options in a third PDF dropdown list based on the selections made in two other dropdown lists.

How to Populate a PDF Dropdown from Two Other Dropdowns
Product
PDF Form Editors
Device & OS
not provided
Scenario
Creating interactive PDF forms where the options in a specific field depend on multiple previous user selections.
Observed behavior
A third dropdown needs to display combined or conditionally mapped options derived from the values of two source dropdown fields.
Before you start

Ensure you have a PDF editing tool that supports JavaScript for interactive forms, and verify that your PDF file has at least three distinct dropdown (combo box) fields created and named properly.

Solution 1Recommended

Use Custom JavaScript to Dynamically Populate the Third Dropdown

Write a custom calculation script to read the values from the first two dropdowns, format them into an array, and assign them as items to the third dropdown.

This method leverages the built-in JavaScript engine of advanced PDF readers. By fetching the selected values from your source fields and placing them into an array, you can use the setItems method to update the target dropdown list dynamically based on user input.

1
Open PDF form properties

Open your PDF form in a capable PDF editor. Right-click the target (third) dropdown field and select 'Properties'.

2
Access the calculation script

Navigate to the 'Calculate' tab in the Properties window and choose the 'Custom calculation script' option.

3
Retrieve source values

Enter the JavaScript code to retrieve the values from the first two dropdowns. For example: var val1 = this.getField('Dropdown1').valueAsString; var val2 = this.getField('Dropdown2').valueAsString;

4
Apply items to the target dropdown

Build an array with these values (ignoring empty selections if necessary) and apply it to the target field using the setItems method: event.target.setItems([val1, val2]);

5
Test the interactive form

Save your PDF document and test the form by changing the selections in the first two dropdowns to see the third dropdown update automatically.

Triggering the Script: To ensure the third dropdown updates immediately, you must enable the 'Commit selected value immediately' option in the 'Options' tab of your two source dropdown fields.
Advanced PDF Form Editing

Create and Manage Interactive PDF Forms with WPS Office

WPS Office provides robust PDF editing capabilities, enabling you to create interactive forms with dropdowns, text fields, and custom validation logic effortlessly.

  1. 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF file you want to edit.
  2. 2. Access the Form tools: Navigate to the 'Form' tab on the top ribbon to access interactive form controls.
  3. 3. Insert Dropdown fields: Click 'Combo Box' to draw your dropdown fields directly onto the page layout.
  4. 4. Configure field properties: Double-click the newly created fields to set their names, add default items, and input custom JavaScript for dynamic population.
Easily insert, edit, and manage dropdown combo box form fields.Fully compatible with standard PDF interactive elements and JavaScript formatting.Lightweight alternative with an intuitive user interface.Supports advanced form calculations, conditional logic, and data export.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my target dropdown updating automatically when I make a selection?

If your target dropdown isn't refreshing, ensure that 'Commit selected value immediately' is enabled in the Options tab for both of your source dropdowns. This setting forces the PDF application to recalculate scripts the moment a user makes a selection.

Can I populate the third dropdown with an entirely new list based on the first two choices?

Yes. Instead of passing the selected values directly, you can use if/else statements or a switch statement in your JavaScript to define a completely distinct array of items for the third dropdown based on the specific combination of the first two selections.

Do these custom JavaScript forms work on all PDF viewers?

While JavaScript forms function perfectly in robust editors like WPS Office and Adobe Acrobat, basic PDF readers or standard web browser viewers may not support JavaScript execution. It is always recommended that users fill out complex interactive forms using a dedicated desktop PDF application.