0

The code I'm working on has a page with date inputs, and uses a Converter to transform the input into a Date object. If the input is not a valid date, a ConverterException is thrown.

I'd like to add a light red or pink background to those inputs that had an error. How to achieve this? It is possible to add an error message next to the field using the h:message tag, but how to set a CSS class for the field?

laurt
  • 1,811
  • 3
  • 15
  • 18
  • 1
    Did you try https://docs.oracle.com/javaee/7/api/javax/faces/component/html/HtmlInputText.html#setStyleClass-java.lang.String- ? – Selaron Nov 20 '19 at 18:08
  • 1
    Did you try https://stackoverflow.com/questions/10993615/highlight-an-inputtext-in-jsf-when-a-validation-error-occurs#10993853? – Kukeltje Nov 20 '19 at 18:59
  • 1
    Possible duplicate of [Highlight an inputText in JSF when a validation error occurs](https://stackoverflow.com/questions/10993615/highlight-an-inputtext-in-jsf-when-a-validation-error-occurs) – Jasper de Vries Nov 21 '19 at 10:48

0 Answers0