title: Highlight an inputText in JSF when a validation error occurs
body: <p>I have a form with a lot of inputText, what I want is to highlight those who are not being filled with correct data.</p>
  
  <p>I tried to use 'component.valid' but it always return that the field is invalid (i.e. fields are always red).</p>
  
  <p>this is the code :</p>
  
  <pre><code>&lt;h:inputText value="#{creerPersonne1.nom}" id="nom" 
      style="#{not nom.valid ? 'border-color:red;' : 'border-color:black;'}"&gt;
      &lt;f:validateRegex pattern="^[a-zA-Z]+$"&gt;&lt;/f:validateRegex&gt;
  &lt;/h:inputText&gt;
  </code></pre>
  
  <p>this is the result :</p>
  
  <p><img src="https://i.stack.imgur.com/pDybL.png" alt="Always invalid"></p>
  
  <p>note that the field is also highlighted when the page is loaded for the first time.</p>