3 Replies Latest reply on Jul 19, 2009 2:20 PM by nbelaevski

    h:selectOneMenu => a4j:support

    superstef

      Hi there,

      i have a problem with the h:selectOneMenu and the a4j:support...

      My first selectOneMenu element controls the second. Only if a defined value has been selected in the first selectOneMenu element, the second will be enabled, otherwise it is disabled. So far so good...

      If the second element is enabled and I select an item in this element, my method onGroupKindChanged will be called by a4j:support, but the submitted value is null.
      If I remove the disabled property from this control, the submitted value is okay.

      WHY?? What do I have to do, to get the right submitted value if I have the disabled property in the second element??

      <h:selectOneMenu id="sex" value="#{userNewHandler.selectedSex}">
      <f:selectItem itemValue="" itemLabel="#{msgT.pleaseSelect }" />
      <f:selectItems id="sexs" value="#{selectableSexHandler.selectableSexItems }" />
      <a4j:support event="onchange" reRender="groupStrength,groupKind,sexPanel,saveBtn"
      actionListener="#{userNewHandler.onSexChanged }"
      immediate="true"
      ajaxSingle="true" limitToList="true" />
      </h:selectOneMenu>
      
      <h:selectOneMenu id="groupKind" rendered="#{userNewHandler.groupSelectionVisible }"
      disabled="#{userNewHandler.groupSelectionDisabled }" disabledClass="disabledElements"
      value="#{userNewHandler.groupKindSelection }">
      <f:selectItem itemValue="" itemLabel="#{msgT.pleaseSelect }" />
      <f:selectItems id="groupKinds" value="#{selectableSexHandler.selectableGroupKindItems }" />
      <a4j:support event="onchange"
       reRender="groupKindPanel"
       actionListener="#{userNewHandler.onGroupKindChanged }"
       immediate="true"
       ajaxSingle="true" limitToList="true" />
      </h:selectOneMenu>
      
      
      public void onGroupKindChanged(ActionEvent ae, UserTO user) {
      
       FacesContext context = FacesContext.getCurrentInstance();
       HtmlSelectOneMenu select = (HtmlSelectOneMenu) ae.getComponent().getParent();
       String value = (String) select.getSubmittedValue();
      ...
      


      With disabled property the value in the method is always null when an item is selected.

      I'm using 3.3.1...

      Greats
      Superstef