[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3407
  • Last Modified:

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?
0
ecarbone
Asked:
ecarbone
1 Solution
 
Karl Heinz KremerCommented:
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

0
 
ecarboneAuthor Commented:
Exactly what I was looking for ... thank you!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now