-
1. Re: Problem with a4j:commandButton and validation error messages
asookazian Jul 16, 2009 10:31 PM (in response to bossy)I recently posted a similar problem.
When you see:
WARNING: FacesMessage(s) have been enqueued, but may not have been displayed
check which element (field) in the form is being referenced in the error message and reRender that field.
The root cause of this warning is that there is a validation msg, for example, and ultimately a FacesMessage instance that has been added to FacesMessages object but has not been rendered on your JSF page. So all you typically need to do is reRender the appropriate component/field.
-
2. Re: Problem with a4j:commandButton and validation error messages
bossy Jul 17, 2009 11:53 AM (in response to bossy)Thanks John,
that did solve the problem.
Solving this issue, however, I stumbled across something else. It may actually be more of an AJAX issue than a Seam one, but I'll ask anyway.
In the same form I have an <a:region> element that contains an input text field and a command button:
<a:region> <s:decorate id="myInputField" > <ui:define name="label">Field</ui:define> <h:inputText immediate="true" requiredMessage="Required" required="true" value="#{myEntityHome.myAttr}" > <a:support event="onblur" reRender="myInputField" /> </h:inputText> <a:commandButton value="Lookup" image="img/search.GIF" ajaxSingle="true" action="#{someBean.someAction}" reRender="listOfIds" oncomplete="if(#{someBean.condition}) { if (#{!someBean.otherCondition}) { Richfaces.showModalPanel('someModalPanel'); } } else { // do something else }"> </a:commandButton> </s:decorate> </a:region>
The input field is a required one.
The issue is that if I submit the form and some of the required fields, including this one, are missing - when I reRender the form in order to show the validation messages, only the validation message for this field is displayed. Only after I type a value and submit again, I can see the messages for the rest of the missing required fields.
What can I do to make sure that I can see all validation error messages the first time I submit the form?
Thanks in advance.