Change the color of a text based on different string - Mendix Forum

Change the color of a text based on different string

0

Hi Friends,

I’m having trouble with the below problem:

Suppose a textbox = “5” , i want to make the text “5” to be red

Suppose a textbox = “4” , i want to make the text “5” to be green

Suppose a textbox = “3” , i want to make the text “3” to be blue.

 

I kinda know i have to put some css code in “style”, not sure how. Can someone point to the right direction?

 

Thanks

 

asked
4 answers
1

You should be able to set your container or other parent element to different CSS classes (for red, green or blue text) based on the string value.  The following widget should help:

https://appstore.home.mendix.com/link/app/108838/

answered
0

Hi Folks,

 

Thanks for your comments. However, i’m using a old modeler. Mendix 5.19. Wondering if any of the CSS code can solve this problem?

 

Thanks

 

answered
0

I prefer the Enum Class widget ;  https://appstore.home.mendix.com/link/app/2641/ , but it is also worth to check out the Dynamic Classes widget as suggested by Michael Giller

answered
0

One quick and easy way to do this is create text boxes for all your different options (i.e. red, blue, green) and set their visibility to only display based on their contents (Something like: contains($textObj/text, ‘3’) then make blue text option visible)

answered