I need the background of a text field to change based on the users entry. For example if the user enter R the background changes to red, G - the background changes to green, Y - the background changes to yellow.
Sure, you can use this code as the field's custom validation script:
if (event.value=="R") event.target.fillColor = color.red;
else if (event.value=="G") event.target.fillColor = color.green;
else if (event.value=="Y") event.target.fillColor = color.yellow;
else event.target.fillColor = color.transparent;
My text fields are within a table in livecycle does this make a difference. I entered your code and it doesn't seem to be working for me. I'm new to live cycle so I'm sure I'm doing something incorrectly
This in the exit event will work:
if (this.rawValue == "R" || this.rawValue == "r") this.fillColor = "255,0,0";
if (this.rawValue == "G" || this.rawValue == "g") this.fillColor = "0,255,0";
if (this.rawValue == "B" || this.rawValue == "b") this.fillColor = "0,0,255";
Thank you jasotastic81. My only question is the color only changes when I mouse click over it.. Is there a way for the color to remain once the entry is made. R turns red and and is visible for each entry.