a4j:support reRender is resetting form values (HelP!)
chris.simons Nov 20, 2008 8:20 PMAfter upgrading to Richfaces 3.2.2.GA, form values are being reset whenever an a4j:support fires. This is even with ajaxSingle="true" for each a4j:support. This did not used to be a problem. In addition, when I set the reRender to something other than the form id itself, the page does not seem to catch the update. Perhaps I am doing something wrong?
Here is some sample code wherein reRender is set to the entire form. In this case, any previously entered values in the form are reset to blank/null. I have also tried setting bypassUpdates="true" to no avail.
<tr> <s:decorate id="countryDecorate" template="/layout/forms/edit.xhtml"> <ui:define name="label">Country:</ui:define> <ui:param name="colspan" value="1"/> <h:selectOneListbox id="country" size="1" required="false" value="#{cvEvent.address.country}"> <a4j:support event="onchange" ajaxSingle="true" reRender="createEventForm"/> <s:selectItems var="value" label="#{value.description}" value="#{valueManager.values['Country']}" /> <s:convertEntity /> </h:selectOneListbox> </s:decorate> <s:decorate template="/layout/forms/emptyEdit.xhtml" /> </tr> <a4j:region id="uiDisplayState" rendered="#{cvEvent.address.country.name == 'US'}"> <tr> <s:decorate id="stateDecorate" template="/layout/forms/edit.xhtml"> <ui:define name="label">State:</ui:define> <ui:param name="colspan" value="1"/> <h:selectOneListbox id="state" size="1" required="false" value="#{cvEvent.address.state}"> <s:selectItems var="value" label="#{value.description}" noSelectionLabel="#{messages['form.controls.noSelectionLabel']}" value="#{valueManager.values['State']}" /> <s:convertEntity /> </h:selectOneListbox> </s:decorate> <s:decorate template="/layout/forms/emptyEdit.xhtml" /> </tr> </a4j:region>
Here is some sample code wherein reRender is set to a specific a4j:region. Shouldn't this work properly? I can tell the event fires but the region does not render.
<tr> <s:decorate id="countryDecorate" template="/layout/forms/edit.xhtml"> <ui:define name="label">Country:</ui:define> <ui:param name="colspan" value="1"/> <h:selectOneListbox id="country" size="1" required="false" value="#{cvEvent.address.country}"> <a4j:support event="onchange" ajaxSingle="true" reRender="uiDisplayState"/> <s:selectItems var="value" label="#{value.description}" value="#{valueManager.values['Country']}" /> <s:convertEntity /> </h:selectOneListbox> </s:decorate> <s:decorate template="/layout/forms/emptyEdit.xhtml" /> </tr> <a4j:region id="uiDisplayState" rendered="#{cvEvent.address.country.name == 'US'}"> <tr> <s:decorate id="stateDecorate" template="/layout/forms/edit.xhtml"> <ui:define name="label">State:</ui:define> <ui:param name="colspan" value="1"/> <h:selectOneListbox id="state" size="1" required="false" value="#{cvEvent.address.state}"> <s:selectItems var="value" label="#{value.description}" noSelectionLabel="#{messages['form.controls.noSelectionLabel']}" value="#{valueManager.values['State']}" /> <s:convertEntity /> </h:selectOneListbox> </s:decorate> <s:decorate template="/layout/forms/emptyEdit.xhtml" /> </tr> </a4j:region>