Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


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

Explorer ,
Aug 13, 2021 Aug 13, 2021

Copy link to clipboard

Copied

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!

TOPICS
JavaScript, PDF forms

Views

57

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Aug 23, 2021 Aug 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 ...

Likes

Translate

Translate
Adobe Community Professional ,
Aug 13, 2021 Aug 13, 2021

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 23, 2021 Aug 23, 2021

Copy link to clipboard

Copied

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.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 23, 2021 Aug 23, 2021

Copy link to clipboard

Copied

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];

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 25, 2021 Aug 25, 2021

Copy link to clipboard

Copied

LATEST

Sweet!  That worked perfectly. 

 

Thank you so much for your assistance.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines