2
votes

I am using primefaces and p:inputText fields that are required, I use global p:messages to display the required info, and growl only from the back end bean. However, on check are displayed both the p:messages and the default p:growl error messages for required fields. Does anyone know how to disable the default growl messages?

<p:messages id="messages" autoUpdate="true"/> 
<h:form id="addUser"> 
<p:growl id="newmessage" showDetail="false" globalOnly="true" /> 
<p:inputText id="name" value="#{manageUser.user.name}" required="true" /> 

and in my backing bean

if (uf.checkUsernameAvailability(user.getLogin())) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Error", "Username already exists!"));} 

I don't understand why they keep appearing if they are not defined.

1

1 Answers

1
votes

The p:growl and p:messages by default display all messages, or global only messages if the attribute is set.

However, both components have another nice attribute redisplay that you could use. Quote from the taglib documentation:

Defines if already rendered messages should be displayed. Default is true.

Set this to false for the component that displays already rendered messages:

<p:growl id="newmessage" showDetail="false" globalOnly="true" 
         redisplay="false" />