Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Is there a way to change txt field background color based on user entry.

Avatar

Level 2

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.

1 Reply

Avatar

Level 2

Insert JavaScript below on the [EXIT] event for the target textField


if (this.rawValue == "R")  {


     this.fillColor = "255,0,0";


      }


else if (this.rawValue == "G")  {


     this.fillColor = "0,255,0";


      }


else if (this.rawValue == "B")  {


     this.fillColor = "0,0,255";


      }


should work fine..

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now