Highlighting the text-box on the basis of the value inside it
Hi , I am using the form loader, having five rows, in my application, the values inside the text-box are dynamic calculated value. What I want is, if the value inside the text-box (<30% then back ground color should become green), if the value of text box is between 31% -70% it should be displayed in yellow color) and if the value is >75% it should be red. How I can do this in mx ? Thanks in Advance!!
Md Naqui Qureshi
One way to do this:
add an enumeration to your project with three values, red, yellow and green.
Add on attribute of type enumeration to the entity for the calculated values.
Set the value of the entity based on the calculated value you mentioned above.
In your Form Loader, have a table with three rows.
Put the attribute value in each of the three rows.
Make each of the three rows visible based on the value of the enumeration attribute you added above
Change the background color of each row using a class or style in the Modeler
I am sure there are other ways to do this also.
One additional note, as I understand it, FormLoader will no longer be supported in a future release of Mendix. You could accomplish all that I mentioned above in a Snippet, which will be supported going forward.
Hope that helps.
We have developed a edit widget with an extra attribute connected to it containing the classname. Changing the classname is done in a microflow with a certain business rule, like the one you mention.
Chris de Gelder
You can use the CSS selector helper widget, already in the appstore. It has a context aware version that will add the value of an attribute as CSS selector. You might need another (enum) attribute that contains the possible states of an object so you can use those values as CSS selectors.