Skip to main content
Participant
May 19, 2021
Question

Adding conditional formatting on drop down options

  • May 19, 2021
  • 2 replies
  • 2578 views

I am working on a fillable form in Adobe DC that I would like to use conditional formatting. I have some text boxes that include a person’s name, email address and phone number. If there a way using conditional formatting, script or something else that will auto populate the email and phone once a person selects the name? All the boxes are drop-down. If so, how do I do that?

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
May 20, 2021

You can use a script on the main field. The others can be text fields, though. There's no reason to have them as drop-downs.

The script can be placed under the Validation event and can be something like this:

 

if (event.value == "John Doe") {
	this.getField("Email").value = "John.Doe@company.com"';
	this.getField("Telephone").value = "(555) 123-4567";
} else if (event.value == "Mary Jane") {
	this.getField("Email").value = "Mary.Jane@company.com"';
	this.getField("Telephone").value = "(555) 420-9999";
}

 

etc.

Participant
May 20, 2021

Thank you,  for the information and the example! I will give this a try. 

Nesa Nurani
Community Expert
Community Expert
May 20, 2021

Are all dropdown fields already set with all the info?

If yes, then you can use "getItemAt()" method to populate phone and email fields.

Participant
May 20, 2021

Good morning Nesa. Yes, my drop downs already have that information loaded. I am new to this, how do I use the "getItemAt()" option? 

Nesa Nurani
Community Expert
Community Expert
May 20, 2021

First item in a list is at  0 2nd is 1...etc getItemAt(0),getItemAt(1), for example lets say you have name option "John Doe" and his info is at first position in dropdown and "Jane Doe" at second position and other dropdown fields are named "Phone" and "Email". As validation script of name dropdown field you could use something like this:

var cPhone = this.getField("Phone");
var cEmail = this.getField("Email");
if(event.value == "John Doe"){
cPhone.value = cPhone.getItemAt(0);
cEmail.value = cEmail.getItemAt(0);}
else if(event.value = "Jane Doe"){
cPhone.value = cPhone.getItemAt(1);
cEmail.value = cEmail.getItemAt(1);}