listShuttle validation quirk ?
gjeudy Mar 10, 2009 5:23 PMHi,
I'm using Richfaces 3.2.1.GA here is my usecase I have a listShuttle that displays data and I hooked a custom JSF validator on a hidden field that is invoked for every row.
Example simplified for demonstration purposes:
<a4j:form id="toRelShuttleForm"> <rich:listShuttle id="toRelShuttle" targetValue="#{relatedToInstances}" sourceValue="#{unrelatedToInstances}" converter="#{a.b.c.converter.IdentifiableConverter}" var="domInstVO"> <h:column> <f:facet name="header"> <h:outputText value="Id" /> </f:facet> <h:outputText value="#{domInstVO.idForJsf}"/> <h:inputHidden value="#{domInstVO.idForJsf}"> <f:attribute name="formId" value="toRelShuttleForm:toRelShuttle" /> <f:attribute name="formFieldNames" value="validFromDate,validToDate" /> <f:attribute name="backingBeanName" value="validityPeriod" /> <f:validator validatorId="validityPeriodValidator"/> </h:inputHidden> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Valid From Dt" /> </f:facet> <h:inputText id="validFromDate" value="#{domInstVO.validityPeriod.validFromDate}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Valid To Dt" /> </f:facet> <h:inputText id="validToDate" value="#{domInstVO.validityPeriod.validToDate}" /> </h:column> <!-- snip snip --> </rich:listShuttle> <h:commandButton type="submit" action="#{domRelateInstancesAction.confirm}" value="Save" rendered="#{editMode}" /> <s:button action="#{conversation.endAndRedirect}" value="Cancel" rendered="#{editMode and conversation.nested}" /> </a4j:form>
If I move an item from source list to target list then change editable fields to an invalid combination on the row. I click the commandButton and validation fails.
The page is rerendered on post-back but the faulty editable fields on the row do not contain the previously invalid submitted values. It contains the initial values, if I try to submit again validation fails again even though the user may believe it should pass because initial value is valid even though JSF UI Tree still contains previously invalid submitted values...
This scenario works if I edit a value already in targetList.
Please advise, this seems like a listShuttle specific quirk.
Thanks,
-Guillaume