Skip to main content
Saher Naji
Inspiring
November 24, 2022
Answered

Change Text Color of an item from Drop Down Menu

  • November 24, 2022
  • 2 replies
  • 2761 views

Hello there,

I hope you are doing well,

 

I am trying to change the color text of one item in a drop-down menu list to grey, (after selecting)

 

I used this code, but it did not work

event.target.textColor = (this.getField("best_time_to_call").valueAsString=="Please select") ? color.grey: color.transparent;

 

 

Thank you

This topic has been closed for replies.
Correct answer try67

thank you, it has turned the color to grey, but what I really need is to turn the color back to Black if any items other than (Select please) are selected


Then use this:

event.target.textColor = (event.value=="Please select") ? color.gray : color.black;

2 replies

ls_rbls
Community Expert
Community Expert
November 24, 2022

Run the script as a Custom Format Script like this:

 

 

(event.value !== "Please select") ? f.textColor = color.black : f.textColor = color.gray;

 

Saher Naji
Inspiring
November 24, 2022

Hi @ls_rbls 

I tested it, it's not working

try67
Community Expert
Community Expert
November 24, 2022

Change it to:

event.target.textColor = (event.value=="Please select") ? color.gray : color.transparent;

try67
Community Expert
Community Expert
November 24, 2022

Be aware this will change the color of all the items in the drop-down, though. It's not possible to change the color of just one.

Saher Naji
Inspiring
November 24, 2022

thank you, it has turned the color to grey, but what I really need is to turn the color back to Black if any items other than (Select please) are selected