if you want to change the style depending on the input, dynamic classes are the way to go, as Martijn suggested. If you want to change the style depending on the length of the input, you could define a dynamic class like this:
If you add the following styles to your App/Styling/web/main.scss, you will see the result:
- the ":focus" pseudo class corresponds to your initial request to change the style when the text box is entered
- the ".red-border" and ".green-border" define how the widget should look depending on the active dynamic class
-the ".mx-textbox" class designates a text input field from the Mendix toolbox.
In the long run, you would put your custom styles in different files of course, but that is besides the point.
You can just create your own class and add it to the Appearance tab of the input widget to override the Mendix styling. There is no need to start a widget from scratch.
Hope this helps!