I have a form with a lot of inputText, what I want is to highlight those who are not being filled with correct data.
I tried to use 'component.valid' but it always return that the field is invalid (i.e. fields are always red).
this is the code :
<h:inputText value="#{creerPersonne1.nom}" id="nom"
style="#{not nom.valid ? 'border-color:red;' : 'border-color:black;'}">
<f:validateRegex pattern="^[a-zA-Z]+$"></f:validateRegex>
</h:inputText>
this is the result :
note that the field is also highlighted when the page is loaded for the first time.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…