I have the following form in a p:outputPanel
<h:form id="someForm">
<p:panel id="panel" header="HEADER">
<h:panelGrid columns="5">
<h:outputLabel value="Name:" for="name" />
<p:inputText id="name" value="#{userBean.name}" required="true"
requiredMessage="ASD" label="name" maxlength="15">
<f:validateLength minimum="10"></f:validateLength>
<p:ajax event="blur" update="inputValidationMessage" />
</p:inputText>
<p:message id="inputValidationMessage" showDetail="true" for="name"
display="icon" />
<p:watermark for="name" value="e.g Jill" />
</h:panelGrid>
<p:commandButton value="Save" update="panel"
actionListener="#{userBean.doSomething}">
</p:commandButton>
</p:panel>
</h:form>
I expect that when the inputText element loses focus and its content has a length less than 10 characters, the message ASD is displayed right next to it. However, what happens in case validation fails is, only a red cross icon is displayed. The message ASD is missing. Changing showDetail to showSummary doesn’t work neither.
Secondly, the commandButton calls userBean.doSomething:
UserBean#doSomething:
public void doSomething(ActionEvent actionEvent) {
RequestContext context = RequestContext.getCurrentInstance();
FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_WARN,
"Summary",
"Detail"));
FacesContext.getCurrentInstance().addMessage(null, facesMessage);
context.addCallbackParam("booleanVar", true);
}
The FacesMessage is not being displayed.
I’m using JSF2.0 with Primefaces 3.0 on Weblogic 12.1.
Any help appreciated.
You’ve declared the
<p:message>as follows:Here’s a cite from the
<p:message>documentation in the PrimeFaces User Guide:So the message severity is displayed as icon and message text is only displayed as tooltip of the icon. You need to remove the
display="icon"so that it will show both in view.