Background Color Conditional

How can i create a condition that changes the component background according to the number filled in by my user on a Input Field?

Example:
If the number filled in by my user is 1, the background changes to Yellow
If the number filled in by my user is 2, the background changes to Red
If the number filled in by my user is 3 or more, the background changes to Blue

You can bind the background color to a formula:

IF(appVars.choice === 2, "red", IF(appVars.choice === 3, "blue", "yellow"))

1 Like

Oh Thanks! It Works!
Another question, can i make this condition for a interval of numbers?

Example:
If the number filled in by my user is 1 to 2 (1.2 ; 1.3; 1.5…), the background changes to Yellow
If the number filled in by my user is 1 to 2, the background changes to Red

Basicly the same that you explained but to a interval (decimals) instead a “natural” number.

Hi, yes, you can express that in a formula with the AND condition &&

IF(appVars.choice > 1 && appVars.choice < 2, "yellow", IF(...))

1 Like

Thanks for the support and patience! I am not a programmer, so I have some doubts that I know are basic! Thanks for the help again!
Congratulations on the platform, it is simple and easy to do everything I want! The help you guys give on the forum is incredible! <3

1 Like

HI. I wanted to do the same thing, but I can’t find the property that I can assign the formula in the input field component. Would you be so kind to point me to it please? Thanks.

Hi @TK_Soh, here’s instructions on how to do it using a local palette:

1 Like

@Mari Thanks. I will check it out.