Skip to main content
Known Participant
January 30, 2025
Answered

Want Dropdown Selection to Trigger Color Change

  • January 30, 2025
  • 1 reply
  • 2184 views

Rusty Java user here. Thanks in advance for the help!

 

In the form below, I need the user's selection from the drop down menu (Dropdown12)  in the Status column (selections are Green, Yellow, Red, N/A) to color that box the corresponding color. I'm running this script as a custom validation script in the Validate tab. I have the "Commit selected value immediately" box checked on the Options tab. 

 

This script turns the dropdown menu background to the correct color (except for black which isn't doing anything), but does not turn the box itself a color. Is what I'm trying to do available in Acrobat?

 

Thank you!

 

if (event.value=="Green")event.target.fillColor=color.green;

else if (event.value=="Yellow")event.target.fillColor=color.yellow;

else if (event.value=="Red") event.target.fillColor=red;

else if (event.value=="N/A") event.target.fillColor==black;

 

------------------

Correct answer Nesa Nurani

Add color.before red and black:
color.red and color.black
And remove one equal sign when setting color black:
event.target.fillColor==black;

1 reply

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
January 30, 2025

Add color.before red and black:
color.red and color.black
And remove one equal sign when setting color black:
event.target.fillColor==black;

Known Participant
January 30, 2025

Thank you for correcting that! I made the change, but the only color change is still the drop down menu background when the selection is made. Their choice in the column remains in black text on the blue background. And, curiously, when the user now clicks on the other cells in the first row, the color of the cell turns from blue to red.

Nesa Nurani
Community Expert
February 4, 2025

If you're talking about Apperance in the Dropdown Properties the fill color is set to nothing. Is there somewhere else this is changed? I also have "Commit Selected Value Immediately" selected on the Options tab in the Drowndown Properties.


You can turn it off under Preferences ⇾ Forms ⇾ Show border hover color for fields.

Every user needs to do it on their computer.