1 Reply Latest reply on Oct 25, 2010 5:44 AM by Ilya Shaikovsky

    Rerender attribute on disabled field problem

    igal s Newbie


      I've an a4j:form that contains two h:selectOneListBox that depend on each other. the second is disabled until we select an item from the first one. in some point we choose an item from the first one and rerender the second one with enable=true and then we submit the form values by clicking the save button. the problem is that the value of the second list box isn't being submitted!? is there a problem with the reRender property that doesn't notify the other component that it should be submitted also after the rerendering?

       

      code sample:

       

       

      <a4j:form id="#{formId}" ajaxSubmit="true">
      <!-- Saving customer id in form  -->
      <input type="hidden" name="customerId"
      value="#{profilesAndOpportunitiesController.customerId}" />
      <input type="hidden" name="profileId"
      value="#{profileController.profileId}" />
      <input type="hidden" name="profileType"
      value="#{profileController.type}" />
      <h:panelGrid columns="2">
      <h:panelGrid columns="2">
      <h:outputText value="#{msg.COUNTRY_ORIGIN}" />
      <h:selectOneListbox id="countryOrigin" size="1"
      value="#{profileController.profileBean.origCountry}"
      converter="countryIdConverter">
      <f:selectItem itemDisabled="true" />
      <f:selectItems value="#{globalSelectItems.countries}" />
      <a4j:support event="onchange"  reRender="countryOrigin,citiesOrigListbox, airportOrigListBox, countryDest,citiesDestListbox" ajaxSingle="true" limitToList="true">
      <f:param name="countryIdOrig" value="#{profileController.profileBean.origCountry.id}"/>
      <f:param name="countryIdDest" value="#{profileController.profileBean.destCountry.id}"/>
      <f:param name="cityDest" value="#{profileController.profileBean.destCity}"/>
      </a4j:support>
      </h:selectOneListbox>
      <h:outputText value="#{msg.CITY_ORIGIN}" />
      <h:selectOneListbox id="citiesOrigListbox" size="1"
      value="#{profileController.profileBean.origCity}">
      <f:selectItem itemDisabled="true" />
      <f:selectItems value="#{profileController.citiesForOrigin}" />
      <a4j:support event="onchange" reRender="countryOrigin,citiesOrigListbox, airportOrigListBox, countryDest,citiesDestListbox" ajaxSingle="true" limitToList="true">
      <f:param name="countryIdOrig" value="#{profileController.profileBean.origCountry.id}"/>
      <f:param name="countryIdDest" value="#{profileController.profileBean.destCountry.id}"/>
      <f:param name="cityDest" value="#{profileController.profileBean.destCity}"/>
      <f:param name="cityOrig" value="#{profileController.profileBean.origCity}"/>
      </a4j:support>
      </h:selectOneListbox>
      <h:outputText value="#{msg.ORIGIN} #{profileController.portOriginString}" />
      <h:selectOneListbox id="airportOrigListBox" size="1"
      value="#{profileController.profileBean.profile.originCargoPoint}"
      converter="cargoPointIdConverter"
      disabled="#{empty param['this.parent.id:citiesOrigListbox']}">
      <f:selectItem itemDisabled="true" />
      <f:selectItems value="#{profileController.cargoPointsForOrigin}" />
      </h:selectOneListbox>


      <a4j:form id="#{formId}" ajaxSubmit="true">

      <h:outputText value="#{msg.CITY_ORIGIN}" />

      <h:selectOneListbox id="citiesOrigListbox" size="1"

      value="#{profileController.profileBean.origCity}">

      <f:selectItem itemDisabled="true" />

      <f:selectItems value="#{profileController.citiesForOrigin}" />

      <a4j:support event="onchange" reRender=" airportOrigListBox, countryDest,citiesDestListbox" ajaxSingle="true" limitToList="true">

      <f:param name="countryIdOrig" value="#{profileController.profileBean.origCountry.id}"/>

      <f:param name="countryIdDest" value="#{profileController.profileBean.destCountry.id}"/>

      <f:param name="cityDest" value="#{profileController.profileBean.destCity}"/>

      <f:param name="cityOrig" value="#{profileController.profileBean.origCity}"/>

      </a4j:support>

      </h:selectOneListbox>


      <h:outputText value="#{msg.ORIGIN} #{profileController.portOriginString}" />

      <h:selectOneListbox id="airportOrigListBox" size="1"

      value="#{profileController.profileBean.profile.originCargoPoint}"

      converter="cargoPointIdConverter"

      disabled="#{profileController.cargoPointsDestDisable}">

      <f:selectItem itemDisabled="true" />

      <f:selectItems value="#{profileController.cargoPointsForOrigin}" />

      </h:selectOneListbox>


      <a4j:commandButton value="#{msg.SAVE}" alt="#{msg.SAVE}"

      reRender="secondListView"

      action="#{profileController.saveProfile}" >

      </a4j:commandButton>

      </a4j:form>


      Any ideas whats going on ?