Reputation: 669
I have a Primefaces 3-field form and a <p:messages>
tag to show some server-side validation messages. But I don't want to display the client-side messages related to the required="true"
option, just highlight the input field with red.
Is there a way to do it with Primefaces?
Upvotes: 6
Views: 14464
Reputation: 763
I did it like this --> rendered="#{not facesContext.validationFailed}"
<p:messages
rendered="#{not facesContext.validationFailed}"
id="msg"
showDetail="true"
autoUpdate="false"
closable="true" />
Upvotes: 0
Reputation: 14277
You can set <p:messages globalOnly="true"/>
, this will just show global messages, which are not attached to any particular field. Also you can user Primefaces' <p:outputLabel/>
for label of input elements, it will add error css to input elements.
You should also update form when you do submit. For example if you do that with command button add update="form_id"
Upvotes: 13