Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces - Do not display message for required fields, just hightlight border

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?

like image 823
CountD Avatar asked Jan 04 '13 13:01

CountD


1 Answers

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"

like image 52
partlov Avatar answered Sep 30 '22 12:09

partlov