These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Help with changing certain text color

Captain Vanhoy
Registered: Oct 23 2011
Posts: 5
Answered

Hello, our City Fire Department has a daily "runsheet" that tells each fire fighter what apparatus they are assigned to each start of the shift. What I'm trying to do is have a drop down box where one of the selections is part time. I want part time to be in red but all other selections to stay black. This is because our part time is paid differently and will obviously stick out.
 
I can't seem to figure this out and hoping there may be a javascript code that will allow it.
 
Thanks in advance for any help!
 

My Product Information:
Acrobat Pro 10.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
You can't set a single item in a drop-down to be red and the other black. However, you can have the text that shows up after the selection is made to be red. This would cause, though, that all the items would be red the next time you open the drop-down.
To do this, insert this code as the custom validate code of your field (you'll need to adjust the value if it's not "Part time"):

if (event.value=="Part time") event.target.textColor = color.red;
else event.target.textColor = color.black;

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Captain Vanhoy
Registered: Oct 23 2011
Posts: 5
Try67, thank-you very much for the reply. That validate script did work for me. I have one more question, if I have multiple drop down names I'd like to made red, such as part time,overtime, and sick time. How could I do that?

Thank-you very much!
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Then you can add a logical OR operator to the if-condition, like so:

if (event.value=="Part time" || event.value=="Overtime" || event.value=="Sick time") ...

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com