PDF Editing Issues

How to Dynamically Populate a PDF Dropdown from Text Fields

Elise WilliamsElise Williams Nov 24, 2026 869 views

Question details

The user wants to configure a PDF dropdown menu to automatically pull and display options based on inputs typed into nearby text fields, while also allowing users to manually type their own custom text into the dropdown.

How to Dynamically Populate a PDF Dropdown from Text Fields
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Designing an advanced interactive PDF form where dropdown options change dynamically based on user input elsewhere on the form.
Observed behavior
The dropdown needs to automatically aggregate values from specific text fields via a custom script and accept custom manual text entry.
Before you start

Ensure you are using a PDF editor that supports advanced form properties and JavaScript calculations, and verify that your target text fields follow a standardized naming convention (e.g., TextBox.1, TextBox.2) for the script to recognize them properly.

Solution 1Recommended

Enable Custom Manual Entry and Add a Calculation Script

Configure the dropdown properties to allow custom user input and insert a JavaScript calculation code to dynamically fetch values from related text fields.

To make the dropdown dynamic, you must first allow custom entries and then use a JavaScript array method in the calculation tab to filter and append the text field values to the dropdown options.

1
Open Dropdown Properties

Enter the form editing or prepare mode in your PDF editor. Double-click the dropdown field you want to modify to open its Properties dialog box.

2
Enable Custom Text Entry

Navigate to the 'Options' tab within the Properties window. Check the box labeled 'Allow user to enter custom text' to ensure manual typing is supported.

3
Access the Calculation Script

Switch to the 'Calculate' tab in the same Properties window. Select the 'Custom calculation script' option and click the 'Edit' button.

4
Insert the JavaScript Code

Paste the calculation script to map your text field values. For example, if your fields are named 'TextBox.1', 'TextBox.2', use code like: if(/^TextBox/.test(event.source.name)){ var textData = this.getField('TextBox').getArray().map(function(a){return a.valueAsString;}); var cList = textData.filter(function(a){return (a.length > 0);}); event.target.setItems(cList); } Click OK and close to apply.

Enable Custom Manual Entry and Add a Calculation Script
Field Naming Rule: The JavaScript code relies on a hierarchical naming structure for your text fields. Make sure your base name (e.g., 'TextBox') matches exactly with the script.
Advanced PDF Form Editing

Easily Create and Edit Interactive PDF Forms with WPS Office

WPS Office provides a comprehensive PDF editor that lets you easily manage document forms, insert dropdown menus, add text fields, and manipulate PDF content without steep learning curves.

  1. 1. Open PDF Form in WPS Office: Launch WPS Office and open your existing PDF document or create a blank one.
  2. 2. Access Form Tools: Click on the 'Form' tab in the top navigation ribbon to reveal all interactive field options.
  3. 3. Insert Form Fields: Select 'Combo Box' for a dropdown menu or 'Text Field', then click anywhere on the page to place your form control.
  4. 4. Customize Field Properties: Double-click the inserted field to modify its appearance, set default options, and format the user inputs.
Easily insert text fields, combo boxes, and check boxes into your documents.Fully compatible with standard PDF forms and Microsoft Office document formats.Lightweight, fast, and features a user-friendly interface for effortless editing.Comprehensive toolkit to convert, merge, split, and electronically sign PDFs.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my PDF dropdown menu not updating when I type in the text fields?

If the dropdown does not update dynamically, ensure the calculation order is correct in your form settings. The text fields must be calculated or processed before the dropdown script runs. Additionally, verify that the field names exactly match the names defined in your JavaScript code.

Can I add fixed items to the dropdown without using scripts?

Yes. If you do not need dynamic population, you can manually add fixed choices by opening the dropdown Properties, going to the 'Options' tab, typing your choice in the 'Item' box, and clicking 'Add'.

Does allowing custom text permanently save the typed value in the form?

Yes, when 'Allow user to enter custom text' is checked, the custom value entered by the user becomes the current selected value for that field and will be preserved when the filled PDF is saved.