How to Auto-Populate State and ZIP Code from a City Dropdown in Acrobat PDF
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.

- 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.
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.
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.
Open your PDF document in Adobe Acrobat, go to the 'Tools' menu, and select 'Prepare Form' to enable field editing.
Add a Dropdown field and name it 'City'. Double-click it to open the Properties window, then navigate to the 'Options' tab.
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.
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.
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'.
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.

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. Open WPS PDF: Launch WPS Office and navigate to the PDF module to open your document.
- 2. Access Form Tools: Click on the 'Form' tab located on the top navigation ribbon to access interactive field options.
- 3. Insert Form Fields: Select 'Combo Box' to insert your city list, and use 'Text Field' for your State/ZIP outputs.
- 4. Configure Properties: Double-click the inserted fields to adjust their properties, add list items, and manage export values for your specific needs.

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.




