Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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:
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you so much Nesa, this worked perfectly for me!!!!