PDF Editing Issues

How to Auto-Populate State and ZIP Code from a City Dropdown in Acrobat PDF

Algirdas JasaitisAlgirdas Jasaitis Nov 5, 2026 868 views

Question details

The user needs to create a city dropdown list in a PDF form that automatically populates the corresponding state and ZIP code into another text field without relying on an external database.

How to Auto-Populate State and ZIP Code from a City Dropdown in Acrobat PDF
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating an interactive PDF form with dependent or auto-filling fields based on a user's dropdown selection.
Observed behavior
The user requires the form to instantly display the correct state and ZIP code as soon as a specific city is selected from the dropdown menu.
Before you start

Ensure you have an advanced PDF editor like Adobe Acrobat Pro installed, as setting up custom calculation scripts and managing form field export values require professional form-editing tools.

Solution 1Recommended

Use Dropdown Export Values and Custom Calculation Scripts

This method stores the State and ZIP code data inside the dropdown's export values and uses a simple JavaScript calculation to push that data into a destination text field.

By utilizing the 'Export Value' feature in the dropdown properties, you can hide the corresponding State and ZIP code data behind the City name. A custom script then retrieves this hidden data and displays it in your designated text box.

1
Enter Prepare Form Mode

Open your PDF document in Adobe Acrobat, go to the 'Tools' menu, and select 'Prepare Form' to enable field editing.

2
Create and Configure the City Dropdown

Add a Dropdown field and name it 'City'. Double-click it to open the Properties window, then navigate to the 'Options' tab.

3
Add Cities and Export Values

In the 'Item' field, type the city name. In the 'Export Value' field, type the corresponding State and ZIP code (e.g., 'CA 90210'). Click 'Add' for each city you want in the list.

4
Enable Immediate Committing

Still in the 'Options' tab of the Dropdown Properties, ensure you check the box that says 'Commit selected value immediately'. This forces the form to update as soon as the user makes a selection.

5
Set Up the Destination Text Field

Create a Text Field where the State and ZIP code will appear. Double-click it to open Properties, go to the 'Calculate' tab, and select 'Custom calculation script'.

6
Insert the Calculation Script

Click the 'Edit' button and paste the following script: event.value = this.getField("City").valueAsString; Click 'OK' and close the properties window. Test the form to see the auto-population in action.

Use Dropdown Export Values and Custom Calculation Scripts
Script Accuracy: Ensure the field name in the script (e.g., "City") matches your actual dropdown field name exactly, as JavaScript is case-sensitive.
WPS PDF Editor

Create Interactive PDF Forms Easily with WPS Office

WPS Office features a robust PDF editor that allows you to seamlessly create interactive forms, insert dropdown menus, and configure text fields without needing highly complex external tools.

  1. 1. Open WPS PDF: Launch WPS Office and navigate to the PDF module to open your document.
  2. 2. Access Form Tools: Click on the 'Form' tab located on the top navigation ribbon to access interactive field options.
  3. 3. Insert Form Fields: Select 'Combo Box' to insert your city list, and use 'Text Field' for your State/ZIP outputs.
  4. 4. Configure Properties: Double-click the inserted fields to adjust their properties, add list items, and manage export values for your specific needs.
Easily insert and customize form elements like dropdown menus, text fields, and checkboxes.High compatibility with Adobe Acrobat PDF forms and standard interactive PDF formats.Lightweight software with an intuitive, user-friendly interface for seamless form building.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my text field updating when I change the dropdown selection?

You likely forgot to enable the 'Commit selected value immediately' option. Open the dropdown's Properties, go to the Options tab, and check this box to ensure the destination field updates instantly.

Can I auto-populate the State and ZIP code into two separate fields instead of one?

Yes, but it requires a more complex JavaScript. You would need to structure your Export Value with a separator (e.g., 'CA|90210') and write a custom script in each destination field to split that string and pull only the required part.

Is it possible to import a long list of cities into the dropdown automatically?

Acrobat does not natively support importing a CSV directly into dropdown options through the default interface. To do this, you would need to use advanced Document JavaScripts or third-party PDF form plugins.