Richfaces Re-render not calling validation
sam-user Apr 16, 2014 5:07 AMI have a Richfaces (3.3.1) page with a form containing number of components. Some of these components are mandatory, so the required attribute is set to true.
I have a commandButton (C1), which calls a server operation. Based on the result of the server operation a field of type h:selectOneMenu (F1)is populated. This field is mandatory and its value is either manually selected by the user or populated via the server operation.
The problem appears when the form is submitted without a value in field F1. Naturally the validation fails and the error message “value is required” (or whatever the value of requiredMessage attribute is) is displayed. If the user then executes the server operation the F1 field is populated with the returned value and it is reRendered. It seems, however, that the validation is not being performed on the client side and the field is still displayed as in error (althouth the error message "value required" disapears). Even if the user manually selects a value after that the field is still displayed as invalid. I’ve been searching on the internet, but couldn’t find a similar case.
Here are some excerpts from my page:
<a:region>
<s:decorate id="alField" template="#{template}">
<ui:define name="label">Al</ui:define>
<h:inputTextarea id="al" maxlength="75"
valueChangeListener="#{aEntHome.clearFields}" requiredMessage="Required"
required="true" value="#{aEntHome.instance.al}">
<f:validator validatorId="stringNotEmtyTrimmedValidator" />
<a:support event="onblur" reRender="F1Field" bypassUpdates="true" />
</h:inputTextarea>
<a:commandButton value="Search" image="img.GIF" id="searchImg"
action="#{lSearch.search}" reRender="F1Field,alField">
</a:commandButton>
</s:decorate>
</a:region>
<s:decorate id="F1Field" template="#{template}">
<ui:define name="label">F1</ui:define>
<h:selectOneMenu value="#{aEntHome.instance.f1}"
required="true">
<s:selectItems value="#{listH.f1List}" var="_c"
label="#{_c.f1Code}(#{_c.f1Name})" />
<s:convertEntity />
</h:selectOneMenu>
</s:decorate>
And this is the template used for displaying the fields:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib">
<div class="prop">
<s:label styleClass="longName #{invalid?'errors':''}">
<ui:insert name="label" />
<s:span styleClass="required" rendered="#{required}">*</s:span>
</s:label>
<span class="value #{invalid?'errors':''}">
<s:validateAll>
<ui:insert />
</s:validateAll>
</span>
<span class="error">
<h:graphicImage value="/img/error.gif" rendered="#{invalid}"
styleClass="errors" />
<s:message styleClass="errors" />
</span>
</div>
</ui:composition>
Could someone suggest what might be going wrong with this code?
I'd really appreciate any help, as I ran out of ideas.