Skip to main content
Participant
Oct 9, 2023 11:48 PM UTC
Answered

Change font colors for choices in drop down list on Adobe PDF using Adobe Acrobat Pro.

I created a dropdown choice box in a PDF for with the following choices:

VERY LOW

LOW

MINOR

MODERATE

SERIOUS

HIGH

 

I would like the font color to change depending on the choice (Green, Green, Blue, Yellow, Orange, Red) from choices above.  Can someone provide the script I can use to do this. Thanks in advance.

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
Oct 10, 2023 4:43 AM UTC

You can use this as 'Validate' script of dropdown field:

if(event.value == "VERY LOW" || event.value == "LOW")
event.target.textColor = color.green;

else if(event.value == "MINOR")
event.target.textColor = color.blue;

else if(event.value == "MODERATE")
event.target.textColor = color.yellow;

else if(event.value == "SERIOUS")
event.target.textColor = ["RGB", 255/255, 136/255, 0/255] ;//orange

else if(event.value == "HIGH")
event.target.textColor = color.red;

When you make a choice it will change to a specific color but if you go and make another choice, while you are choosing all choices will have that same color if it's fine with you leave as it is, but if you wish for them to have black color while selecting use this as 'Mouse Down' action of same dropdown field:

event.target.textColor = color.black;

4 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
Oct 10, 2023 4:43 AM UTC

You can use this as 'Validate' script of dropdown field:

if(event.value == "VERY LOW" || event.value == "LOW")
event.target.textColor = color.green;

else if(event.value == "MINOR")
event.target.textColor = color.blue;

else if(event.value == "MODERATE")
event.target.textColor = color.yellow;

else if(event.value == "SERIOUS")
event.target.textColor = ["RGB", 255/255, 136/255, 0/255] ;//orange

else if(event.value == "HIGH")
event.target.textColor = color.red;

When you make a choice it will change to a specific color but if you go and make another choice, while you are choosing all choices will have that same color if it's fine with you leave as it is, but if you wish for them to have black color while selecting use this as 'Mouse Down' action of same dropdown field:

event.target.textColor = color.black;
Translate
Participant
Oct 10, 2023 2:04 PM UTC

Thank you so much.  Works perfectly!

Translate