Copy link to clipboard
Copied
Hello,
I have looked in the community and found similar questions and answers, and have tried some of the suggested scripts, but have not have any luck making any work yet.
I'm using Adobe Creative Cloud v 5.10.0.573
Tool: Acrobat Prepare Form on a Mac: OS Monterey v 12.4
I have a drop down menu in a field that has several options of people's names to choose from.
I'd like a text field to autofill with an address, based on which name is selected (each address is different, based on which name is selected).
I am not too familiar with javascript but am totally ok with learning.
Any help is greatly appreciated!
Use a validation script on the dropdown:
For example:
if(event.value == "Larry")
{
this.getField("Address").value = "Larry's Address";
}
else if(event.value == "John")
{
this.getField("Address").value = "John's Address";
}
else
{
this.getField("Address").value = "";
}
In this code the names and addresses are hard coded in the script. Its simple but limited. If you ever need to add or change names/addresses you'll have to edit the code. A better approach is to use a document leve
...Copy link to clipboard
Copied
Use a validation script on the dropdown:
For example:
if(event.value == "Larry")
{
this.getField("Address").value = "Larry's Address";
}
else if(event.value == "John")
{
this.getField("Address").value = "John's Address";
}
else
{
this.getField("Address").value = "";
}
In this code the names and addresses are hard coded in the script. Its simple but limited. If you ever need to add or change names/addresses you'll have to edit the code. A better approach is to use a document level variable to hold a list of names/addresses that can then be used to populate both the entries in the dropdown and the address of the selected item.
Here's an article that covers this technique. It's really old, but still good.
https://acrobatusers.com/tutorials/change_another_field/
Copy link to clipboard
Copied
Thank you, will try this immediately!
Copy link to clipboard
Copied
It worked, thank you!