How to Auto-Populate Email and Phone Fields from a PDF Dropdown
Question details
The user needs a method to automatically fill related contact text fields (such as email and phone number) in a PDF form based on the selection made in a main dropdown menu.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where selecting a person's name from a dropdown list dynamically inserts their respective contact details into separate fields.
- Observed behavior
- The user is looking for the correct JavaScript syntax and placement within the PDF editor to link the dropdown selection to the corresponding output text fields.
Ensure you have the exact field names for your dropdown menu and target text fields, as JavaScript is case-sensitive. It is recommended to use standard Text Fields for the output rather than additional dropdowns.
Use a Custom Validation Script
This is the most straightforward method, using an if/else JavaScript statement mapped to the dropdown's validation event.
By applying a custom script to the Validation tab of your main dropdown field, the PDF will automatically evaluate the chosen name and push the designated email and phone number to the target text fields immediately after a selection is made.
Create your main Dropdown field for the names. Then, create standard Text Fields for the email and phone number, naming them 'Email' and 'Telephone' respectively.
Right-click the dropdown field, select 'Properties', and navigate to the 'Validation' tab.
Select 'Run custom validation script' and input the following code: if (event.value == "John Doe") { this.getField("Email").value = "John.Doe@company.com"; this.getField("Telephone").value = "(555) 123-4567"; }
For more names, expand the script using 'else if' statements, like so: else if (event.value == "Mary Jane") { this.getField("Email").value = "Mary.Jane@company.com"; this.getField("Telephone").value = "(555) 420-9999"; }

Use the getItemAt() Method
Best used when your dropdown items are already populated with structured contact data through export values.
Create and Manage PDF Forms Easily with WPS Office
WPS Office provides robust and intuitive PDF form editing tools. Easily insert text fields, dropdown menus, and checkboxes to create interactive forms that are highly compatible with standard PDF readers.
- 1. Open Your PDF Document: Launch WPS Office and open the PDF file you wish to make interactive.
- 2. Navigate to Form Tools: Click on the 'Form' tab in the top navigation ribbon to reveal all interactive form controls.
- 3. Insert Form Elements: Select 'Drop-Down List' or 'Text Field' and click anywhere on the page to insert the element.
- 4. Customize Field Properties: Double-click the newly added field to adjust its name, appearance, and underlying properties.

Frequently Asked Questions
Why are my target text fields not updating when I select a name?
This usually happens if the field names in your JavaScript (e.g., 'Email') do not perfectly match the actual field names in your PDF properties. Remember that JavaScript is case-sensitive, so 'Email' and 'email' are treated differently.
Do the target fields for email and phone need to be dropdowns too?
No, it is highly recommended to use standard Text Fields for the output data (like email and phone). There is no reason to use a dropdown field if the user isn't supposed to choose from a list in those specific boxes.
What if my dropdown list contains hundreds of names?
For very long lists, using a long chain of 'if/else if' statements can become tedious and slow. In such cases, it is more efficient to use a switch statement, or bind document-level JavaScript arrays and retrieve the data using methods like getItemAt().
Where exactly do I paste the JavaScript code in the PDF form?
Right-click your main Dropdown field, go to Properties, select the Validation tab, check the 'Run custom validation script' option, and paste your code into the text box provided.




