1 Reply Latest reply on Mar 23, 2007 1:44 PM by Sergey Smirnov

    selectOneMenu looses data in ajax region

    chelaru.viorel Newbie

      hi all,
      i have a really big problem; i use myfaces 1.1.4 and tomahawk 1.1.3 and ajaxjsf 1.1.0;

      i've made an a4j region that contains besides other components, 3 selectOneMenu-s ; 1 is societa, 2 is fondo, 3 is divisa; if i select a societa, the fondo selectOneMenu is reloading, if i select a fondo the divisa selectOneMenu is reloading... all with ajax;

      when i enter the page, the societa selectOneMenu is loaded, and fondo and divisa selectOneMenu-s are empty...because all combos depend on each others selection.

      the problem is that after i select a societa, and then a fondo and then i press the button(t:commandButton) to submit the page... i get a validation error near the fondo selectOneMenu...that says "Value is not an option"; i went to the html generated and i saw that the fondo html select is empty; and of course .. in the bean , the selectedFondoSO property was set....and now wants to select some fondo from a list of nothing; if i press the second time the submit button ...it WORKS...again i when to the generated html and the fondo selectOneMenu EXISTS...it's not empty....why the second time works ? i think it has something to do with the lifecycle phases of ajax4jsf.

      please help...it's a bit urgent... thanks...

      here is a bit of the code extracted from my page...:

      <a4j:region selfRendered="true" id="insOrdAjaxRegionId" >
      <h:form id="insOrdFormId">
       <t:saveState value="#{bcoSession}" />
       <t:saveState value="#{insertOrdersBean}" />
      ..........................
      <t:selectOneMenu id="societa_id" forceId="true" styleClass="standardComboClass"
       binding="#{insertOrdersBean.societaSelectOneMenu}"
       value="#{insertOrdersBean.selectedSocieta}"
       >
       <a4j:support event="onchange" id="ajaxRefreshFondiId"
       action="#{insertOrdersBean.reloadFondiList}"
       reRender="fondiSO_id,fondiRI_id"
       immediate="true"
       onsubmit="antiDummyInsOrd(true);"
       oncomplete="antiDummyInsOrd(false);showHideDisableEnable();"
       />
       <f:selectItems value="#{insertOrdersBean.societaList}" />
       </t:selectOneMenu>
       <t:message for="societa_id" styleClass="error" showDetail="true"
       showSummary="false" />
      ...........................
      
      <t:selectOneMenu id="fondiSO_id" forceId="true" styleClass="standardComboClass"
       value="#{insertOrdersBean.selectedFondoSO}"
       binding="#{insertOrdersBean.fondiSOSelectOneMenu}"
       >
       <a4j:support event="onchange" id="ajaxRefreshDivisaId_SO"
       action="#{insertOrdersBean.reloadDivisaList}"
       reRender="divisa_id"
       immediate="true"
       onsubmit="if ( operSORIChecked() ) antiDummyInsOrd(true); else return false; "
       oncomplete="antiDummyInsOrd(false);showHideDisableEnable();"
       />
       <f:selectItems value="#{insertOrdersBean.fondiList}" />
       </t:selectOneMenu>
       <t:message for="fondiSO_id" styleClass="error" showDetail="true"
       showSummary="false" />
      ...................................
      <t:selectOneMenu id="divisa_id" forceId="true" styleClass="standardComboClass"
       value="#{insertOrdersBean.selectedDivisa}"
       binding="#{insertOrdersBean.divisaSelectOneMenu}">
       <f:selectItems value="#{insertOrdersBean.divisaList}" />
       </t:selectOneMenu>
       <t:message for="divisa_id" styleClass="error" showDetail="true"
       showSummary="false" />
      ....................
       </h:form>
      </a4j:region>