How to Auto-Populate Multiple PDF Form Fields from a Drop-Down List
Question details
The user needs to automatically fill multiple target text fields (such as property names, addresses, and manager details) based on the selection made in a single drop-down list using a JavaScript lookup approach.

- Product
- PDF Form Editors
- Device & OS
- not provided
- Scenario
- Creating an interactive and dynamic PDF form where users select an item from a drop-down menu, and related information instantly populates into other designated form fields.
- Observed behavior
- Instead of users manually typing related data, the goal is to trigger an automated population script during the drop-down field's validation or selection action to instantly assign values to the related fields.
Ensure your PDF editor supports interactive form field creation and custom JavaScript execution. Make a list of all exact field names for the drop-down list and the target text fields you plan to populate.
Use JavaScript Validation to Create a Data Lookup
Embed a custom JavaScript data structure into the drop-down field's validation action to retrieve and assign values to other fields instantly.
To populate multiple text fields based on a single drop-down selection, you need to use a JavaScript data structure (such as an array or JSON object) containing all the associated details. When the drop-down selection changes, the script looks up the selected value and pushes the corresponding data into the target fields.
Open your PDF document in an advanced PDF editor and enter the Form Editing mode to view all interactive fields.
Right-click the drop-down field that will act as the trigger, select 'Properties', and navigate to the 'Validate' or 'Format' tab depending on your software's interface.
Select the option to 'Run custom validation script' and click the 'Edit' button to open the JavaScript editor window.
Define your data object and use the getField method. For example: var propertyData = {'Prop1': {manager: 'John Doe', phone: '555-1234'}}; if (event.value && propertyData[event.value]) { this.getField('ManagerField').value = propertyData[event.value].manager; this.getField('PhoneField').value = propertyData[event.value].phone; } else { this.getField('ManagerField').value = ''; this.getField('PhoneField').value = ''; }

Create and Manage Advanced PDF Forms with WPS Office
WPS Office provides a comprehensive PDF editor that lets you quickly build interactive forms, insert drop-down lists, and manage text fields within a highly intuitive interface.
- 1. Open the Document: Launch WPS Office and open your PDF document.
- 2. Access the Form Tab: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form controls.
- 3. Insert Form Controls: Use the 'Combo Box' tool to place your drop-down list and the 'Text Field' tool for the dependent fields.
- 4. Configure Properties: Double-click any field to access its properties menu, where you can define field names, export values, and formatting.

Frequently Asked Questions
Why is my JavaScript not updating the target text fields?
This commonly occurs if the target field names in your script do not exactly match the actual field names in the PDF document, or if JavaScript execution is disabled in the PDF viewer's security settings.
Can I use this method to populate text fields on different pages?
Yes. As long as the target field names are correctly referenced in your script, the this.getField() method can target and populate form fields located anywhere within the same PDF document.
Where is the best place to add the JavaScript for a drop-down list?
For drop-down lists, placing the script in the Custom Validation or Custom Keystroke event is the standard practice. This ensures the script triggers instantly the moment the user selects a new value from the drop-down.




