Skip to main content
Participant
October 10, 2023
Answered

Custom Drop Down Colors

  • October 10, 2023
  • 1 reply
  • 702 views

New to creating a script in PDF, so I need some help.  I need to the drop down color to be red, yellow, greem or trasparent based on a selection "high" - red, "Medium" - yellow, "Low" - green, and "N/A" to be no color. 

 

I read some similar posts and created the script below. I think my problem is how I am loading it under "actions". Can someone please validate the script then walk me through the process to load the script? Thank you! 

 

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

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

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

else if (event.value =="" || event.value == " ") event.target.fillColor = color.transparent

This topic has been closed for replies.
Correct answer try67

How would I do that? Thanks for the help! Much appreciated! 


Go to Edit - Preferences - Forms, and tick off "Show border hover color for fields".

1 reply

try67
Community Expert
Community Expert
October 10, 2023

Change this:

(event.value = "High")

To:

(event.value == "High")

And then put it under the field's custom Validation event, and make sure to tick the option to commit the selected value immediately (under the Options tab), and it should work.

Participant
October 10, 2023

That helped. Making progress.  Now, when I select any of the options, the dropdown color will show but the backgroud stays transparent. Any idea what could coause that? 

try67
Community Expert
Community Expert
October 10, 2023

Try disabling the fields highlighting in the application.