Skip to main content
Participant
Oct 10, 2023 8:33 PM UTC
Answered

Custom Drop Down Colors

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Oct 10, 2023 10:20 PM UTC

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".

6 replies

try67
Community Expert
Community Expert
Oct 10, 2023 8:45 PM UTC

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.

Translate
Participant
Oct 10, 2023 9:00 PM UTC

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? 

Translate
try67
Community Expert
Community Expert
Oct 10, 2023 9:42 PM UTC

Try disabling the fields highlighting in the application.

Translate