PDF Editing Issues

Automatically Fill Phone and Email Fields from a PDF Drop-Down in Adobe Acrobat

Emma BrownEmma Brown Nov 19, 2026 868 views

Question details

Automatically populate phone and email fields when a user selects a city in a PDF drop-down list.

Automatically Fill Phone and Email Fields from a PDF Drop-Down in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form contains a city drop-down and separate phone and email fields for the selected location.
Observed behavior
Selecting a city should display the corresponding phone number and email address in the form.
Before you start

Open the PDF in a version of Adobe Acrobat that supports editing form fields, and check the exact names of the drop-down, email, and phone fields. Note whether the drop-down uses export values that differ from the displayed city names.

Solution 1Recommended

Add a validation script to the Acrobat city drop-down

Use a custom validation script to assign contact details whenever the selected city is committed.

1
Open the form editor

Open the PDF in Adobe Acrobat and choose All tools > Prepare a form. Create the city drop-down and the email and phone text fields if they do not already exist.

2
Check field names and values

Open each field's Properties and check its name. In the drop-down's Options tab, check the values assigned to the city choices and enable Commit selected value immediately so the fields update when a choice is made.

3
Add the validation script

Open the city drop-down's Properties, select the Validate tab, choose Run custom validation script, and click Edit. Enter this example: var emailTxt = ""; var phoneTxt = ""; if (event.value == "Marseille") { emailTxt = "Marseille@example.com"; phoneTxt = "0101010101010"; } else if (event.value == "Lyon") { emailTxt = "Lyon@example.com"; phoneTxt = "02020202020202"; } else if (event.value == "Paris") { emailTxt = "Paris@example.com"; phoneTxt = "03030303030303"; } this.getField("Email").value = emailTxt; this.getField("Phone").value = phoneTxt;

4
Customize and test

Replace the example city values, contact details, and the Email and Phone field names with those used in your form. Save the script and use Preview in Prepare a form to select each city and check both fields.

Add a validation script to the Acrobat city drop-down
Viewer support: The script runs only in a PDF viewer that supports and permits Acrobat JavaScript. An unmatched selection clears both contact fields.
Free Microsoft Office alternative

Work with PDF and Office documents in WPS Office

WPS Office is a free, lightweight alternative for working with PDF and Microsoft Office files in a familiar interface. Open compatible documents to make migration easier; use Adobe Acrobat to configure the PDF validation script described above.

Open and work with PDF documents alongside office filesCompatible with common Microsoft Office formats, including DOCX, XLSX, and PPTXFamiliar interface for users moving from Microsoft OfficeFree, lightweight suite for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Why don't the contact fields update immediately after I select a city?

In Prepare a form, open the drop-down's Properties > Options and enable Commit selected value immediately. Then test the selection in Preview.

Should the script compare the city label or its export value?

Compare event.value with the value submitted by the drop-down. If a choice has an export value different from its displayed label, use that export value in the script.

How do I add another city?

Add the city to the drop-down under Properties > Options, then add another else-if block in the Validate tab's custom script with its value, email address, and phone number.

Will the form work in every PDF viewer?

No. The viewer must support and allow Acrobat JavaScript. Test the saved PDF in the viewer your recipients will use.