Populate a PDF form field based on drop-down selection

I created a PDF form using Acrobat 8 Pro.
I have a drop down field called 'Location' and I have pre-populated it with 8 location names.
I have a text box field called 'Address' and it is blank.

When the user selects one of the locations from the 'Location' drop-down list, I want the field called 'Address' to automatically populate with that location's address.

How do I do this?
LVL 10
Who is Participating?
Karl Heinz KremerConnect With a Mentor Commented:
I assume you know how to add JavaScript to a form field. For the following to work, you need to create a custom validation script for your list box ("Location"). Just replace the "ValueX" strings with the actual strings from your list box, and the "txtX" strings with your address strings.
var v = event.value;
var targetValue = "";
if (v == "Value1")
    targetValue = "txt1";
else if (v == "Value2")
    targetValue = "txt2";
else if (v == "Value3")
    targetValue = "txt3";
else if (v == "Value4")
    targetValue = "txt4";
this.getField("Address").value = targetValue;

Open in new window

ecarboneAuthor Commented:
Exactly what I was looking for ... thank you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.