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
BedrockMission!

Learn More

View all

Sign in to view all badges

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

Avatar

Avatar
Level 1
michelej0221
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
michelej0221
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile
michelej0221
Level 1

02-07-2015

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.

Accepted Solutions (0)

Answers (7)

Answers (7)

Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

06-07-2015

Here's a screenshot of how I set this up. The color should stay once you leave the field unless there's something else causing it to change.

786000_pastedImage_0.png

Avatar

Avatar
Level 1
michelej0221
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
michelej0221
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile
michelej0221
Level 1

06-07-2015

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.

Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

02-07-2015

I'm sorry, I didn't see that you asked for yellow.


if (this.rawValue == "Y" || this.rawValue == "y") this.fillColor = "255,255,0";


Avatar

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
jasotastic81
Level 4

Likes

35 likes

Total Posts

329 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jasotastic81
Level 4

02-07-2015

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


Avatar

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
try67
Level 2

02-07-2015

Yes, it does make quite a difference. I'll move your question to the LCD forum.

Avatar

Avatar
Level 1
michelej0221
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
michelej0221
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile
michelej0221
Level 1

02-07-2015

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

Avatar

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
try67
Level 2

Likes

14 likes

Total Posts

120 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
try67
Level 2

02-07-2015

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;