Skip to main content
Inspiring
August 13, 2021
Answered

Populate the State field and Zip Code field once a City is selected from a dropdown menu.

  • August 13, 2021
  • 1 reply
  • 3003 views

I’m Not very familiar with this in Adobe Acrobat Pro DC.  Would like to create a dropdown list with certain City Names and when one is selected it populates the State field and Zip Code field with the corresponding information.

I've looked and found a few things but it's all very confusing to me.


Thanks for any input!

This topic has been closed for replies.
Correct answer fcbg1234

After some trial and error I got things working in a very simple mannor with out using an embedded or external data source.

 

I created my dropdown with each City and added the State & Zip Code to the Export Value field for each City and selected "Commit selected value immediately".

 

Then on the text field where the State and Zip Code are displayed, I added this to the "Custom Calculation Script", event.value = this.getField("City").valueAsString;

 

The only draw back is that the City & Zip Code are displayed in the same field but for my application this will work.

 

Thanks for your suggestion.

 

1 reply

try67
Community Expert
Community Expert
August 13, 2021

You will need to use a custom-made script to do it, and the full data set will have to be embedded in the file, either as a part of the script, or read from an external source, like an attached text file.

 

I've actually developed a (paid-for) tool that allows you to do it very easily, without having to write any code.

You can find it here: https://www.try67.com/tool/acrobat-populate-fields-from-dropdown

fcbg1234AuthorCorrect answer
Inspiring
August 23, 2021

After some trial and error I got things working in a very simple mannor with out using an embedded or external data source.

 

I created my dropdown with each City and added the State & Zip Code to the Export Value field for each City and selected "Commit selected value immediately".

 

Then on the text field where the State and Zip Code are displayed, I added this to the "Custom Calculation Script", event.value = this.getField("City").valueAsString;

 

The only draw back is that the City & Zip Code are displayed in the same field but for my application this will work.

 

Thanks for your suggestion.

 

try67
Community Expert
Community Expert
August 23, 2021

You can easily fix that last issue.

Change your output format to "State,ZipCode" and then as the custom calculation script of the State field use this:

event.value = this.getField("City").valueAsString.split(",")[0];

And under the Zip Code field use this:

event.value = this.getField("City").valueAsString.split(",")[1];