2 Replies Latest reply on Feb 29, 2008 5:01 AM by Nitin Nair

    a4j:support action function does not populate backing bean p

    Nitin Nair Newbie

      Hi,
      I am trying to develop a form which contains various editable fields. Two fields in this form are of type dropdown list. It is a requirement that upon changing values in one of the dropdown, contents of the other dropdown list be changed as well. In order to do this, I am using a4j:support in the JSF as shown below:

      <tr>
      <td class="txtField">
      <h:selectOneMenu id="drpState" name="drpState" class="drpField" value="#{searchProfileBackingBean.searchCriteria.stateName}">
      <a4j:support event="onchange" action= "#{searchProfileBackingBean.changeLocation}" immediate="true" reRender= "locationPanel" />
      <f:selectItems value="#{searchProfileBackingBean.state}"/>
      </h:selectOneMenu>
      </td>
      </tr>
      
      <tr>
      <td class="txtField">
      <a4j:outputPanel id="locationPanel" ajaxRendered="true">
      <h:selectOneMenu id="drpLocation" name="drpLocation" class="drpField" value="#{searchProfileBackingBean.searchCriteria.location}">
      <f:selectItems value="#{searchProfileBackingBean.locationDisplayList}"/>
      </h:selectOneMenu>
      </a4j:outputPanel>
      </td>
      </tr>
      


      As you can see upon changing of value in the dropdown list the function changeLocation() in the backing bean gets invoked (as shown below)
      public void changeLocation()
      {
      String selectedState = searchCriteria.getStateName();
      locationDisplayList = location.get(selectedState);
      }
      


      However the value of searchCriteria.getStateName() is coming as null...Have tried changing lot of properties but to no avail..

      Can anyone shed lights on what wrong could I be doing...

      Thanks
      Nitin