View Full Version : Highlight mandatory fields(text boxes) in red color

4 Nov 2014, 6:35 AM
I need to highlight the mandatory fields (text boxes basically) in red color like in the given image below,
Expected behavior: When the field is empty, it should be highlighted in red color.
I have set allowBlank field to false and applied a css class to invalidCls property. Its working as expected when I clear the textbox after loading some data. But when I load the application or refresh the page it does not work. Without loading a value to the textbox even if I clear it, it does not work. The only way I can do it is by focusing the cursor to it. But there are multiple mandatory fields, I can not focus all of them together.
Can anyone give a solution for this problem?


5 Nov 2014, 2:16 PM
After the form is rendered you can do an isValid() check on the form and that will highlight any invalid fields.