Skip to main content
Participating Frequently
December 25, 2023
Answered

How do I create a list that will populate information based off what is chosen in a drop down list?

  • December 25, 2023
  • 1 reply
  • 1151 views

I want to create a drop down list when the names of tow companies.

Under the drop down list, I assume I would add a text box (?) that would then provide the address, phone/fax numbers for the tow company selected.

Can someone tell me how to do this?

I greatly appreciate any assistance that can be provided.

Thank you,

Valerie

This topic has been closed for replies.
Correct answer Nesa Nurani

You would put script in the dropdown field.

If you create text field and goes to that field properties → options tab, there is an option to check for multiline field (if you want address and phone to be in one field) in that case you would need slightly different script, here is an example:

let's say text field name is "Company Info":

var f = this.getField("Company Info");

switch(event.value){

case "Company1":
f.value = "Address1\nPhone1";
break;
 
case "Company2":
f.value = "Address2\nPhone2";
break;

default:
f.value = "";}

\n is new line separator.

1 reply

Nesa Nurani
Community Expert
Community Expert
December 26, 2023

Are phone/fax and address in the same field, or separate fields for phone and address?

If each is in a separate field, you can find the answer here:

https://community.adobe.com/t5/acrobat-discussions/adress-fields-being-populated-based-on-chosen-dropdown-field/m-p/13583696 

Valerie03Author
Participating Frequently
December 26, 2023

Nesa, thank you for the quick response. I'm just a basic user and learning how to create forms. I've read where others have a drop-down box for items (in my case the name of tow companies), but I don't know where to go from there. What type of field would I create to include the address and phone numbers, as I don't see where I can type more than one line in the options I've looked at?

Once I have the separate fields, then I would use the answer you provided. BTW which field would I place the "validation" script in?

Again thank you for your assistance.

Valerie03Author
Participating Frequently
December 26, 2023

You would put script in the dropdown field.

If you create text field and goes to that field properties → options tab, there is an option to check for multiline field (if you want address and phone to be in one field) in that case you would need slightly different script, here is an example:

let's say text field name is "Company Info":

var f = this.getField("Company Info");

switch(event.value){

case "Company1":
f.value = "Address1\nPhone1";
break;
 
case "Company2":
f.value = "Address2\nPhone2";
break;

default:
f.value = "";}

\n is new line separator.


Thank you so much Nesa, this worked perfectly for me!!!!