Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

Javascript to change fill color based on dropdown input

$
0
0

First, let me start by saying that I am a 1,000,000% novice.  I merely type my question in google and spend a ridiculous amount of time looking and praying for scripts that I can cut, paste and modify it see if they work.  Most of the time, I have no idea how it works and I don't really care as long as it works.  So, with that said, here's my issue.  I have an Adobe Acrobat Pro XI form (NOT LiveCycle) that I created.  I have dropdown fields with values of Exceeds (blue), Meets (green), Needs Improvement (yellow) and Does Not Meet (red).  When the user selects the applicable value, I need the field to change to the color.  The script below was working fine UNTIL I got overzealous and thought I could change blue and green to shades that I preferred.  Now, even though I've removed my RGB definitions of those colors, if I select Exceeds or Meets, the fill color is Aqua.  It's as though I've 'broken' the defaults and it's being held in memory.  Here is the script I'm using.  Again, I copied this script somewhere off the web, so please be kind

 

 

 

if (event.value=="Exceeds") event.target.fillColor = color.blue;

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

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

else if (event.value=="Does Not Meet") event.target.fillColor = color.red;

else event.target.fillColor = color.white;

 

 

Here is the script I used when I tried to redefine the colors:

 

color.blue= ["RGB", 0,112,192];

color.green= ["RGB", 0,176,80];

if (event.value=="Exceeds") event.target.fillColor = color.blue;

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

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

else if (event.value=="Does Not Meet") event.target.fillColor = color.red;

else event.target.fillColor = color.white;

 

How do I get Exceeds and Meets back to blue and green and how can I define what shades of blue and green I want?

 

Thanks!


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>