Copy link to clipboard
Copied
I am working on creating a form for my company. One of the questions on the form is asking for them to select a location. How can I get each locations' Location Name, Address, Telephone # & Fax # to populate within the field once the Location Name is selected from the drop down?
Copy link to clipboard
Copied
As 'Validation' script of Dropdown field use something like this:
var f1 = this.getField("Location Name");
var f2 = this.getField("Address");
var f3 = this.getField("Telephone");
var f4 = this.getField("Fax");
switch(event.value){
case "Location1":
f1.value = "Location1 Name goes here";
f2.value = "Location1 address goes here";
f3.value = "Location1 telephone number goes here";
f4.value = "Location1 fax number goes here";
break;
case "Location2":
f1.value = "Location2 Name goes here";
f2.value = "Location2 address goes here";
f3.value = "Location2 telephone number goes here";
f4.value = "Location2 fax number goes here";
break;
default:
f1.value = "";
f2.value = "";
f3.value = "";
f4.value = "";}
Change field names to your actual field names and add more locations (before 'default' line) also "Location1" and "Location2" are just examples, change those to your actual dropdown choices you have for locations.
In dropdown field properties, under options tab, check 'Commit selected value immediately'.
Copy link to clipboard
Copied
Where would I put this script? I have not used the Validation feature before.
I have found a way to put all of the information into the drop-down, but I would prefer to only show the Location Names in the drop-down instead of all of the information if that makes sense.
Copy link to clipboard
Copied
Put it at validation of the dropdown field.
Copy link to clipboard
Copied
Read this article:
https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm
Are here are two articles that cover the question you've asked. While the article use the Keystroke event, they can be easily modified for use in the validation event.
https://acrobatusers.com/tutorials/change_another_field/
https://acrobatusers.com/tutorials/list_and_combo_in_lc/