Message from "required" PrimeFaces

1

I have the following scenario:

<h:form id="formValor">

   <p:growl id="growlMessage" showDetail="true" autoUpdate="true"  showSummary="false" />
   <p:tabView id="tabViewVinculo" dynamic="true" widgetVar="tabViewVinculo"...>
       <p:tab id="tab1">
              <p:input id="inputValue" value="{beam.valor}" required="true" />
       </p:tab>
        <p:tab id="tab1=2">
              <p:input id="inputValue2" value="{beam.valor2}"/>
       </p:tab>

   <p:commandButton id="buttonConfirmar" value="Submit" process="@form" validateClient="true" update="growlMessage" .../>
</form>

Having this scenario I would like to customize the message displayed in the growl that comes as follows:

"formValue: inputValue: Validation error: value is required."

NOTE: I would not like to change the "p: growl" component to "p: message"

** Considering tab 2 active ****

    
asked by anonymous 28.08.2015 / 18:22

2 answers

3

Just use% component_component:

<p:inputText id="inputValue" requiredMessage="SUA MENSAGEM" value="{beam.valor}" required="true" />
    
28.08.2015 / 19:55
0

In this case, I'd put growl as globalOnly="true" and add messages directly from Bean:

FacesContext context = FacesContext.getCurrentInstance();
    context.addMessage(null, new FacesMessage(
         FacesMessage.SEVERITY_ERROR,     
         "Erro!",
         "Informe um valor para input1."));
    
28.08.2015 / 22:06