3 Replies Latest reply on May 3, 2010 3:02 AM by Harut Sargsyan

    How to obtain the selected combo box item using a4j:support

    Rudi Welter Newbie

      Hi friends,

       

      I've a rich:comboBox in a modalPanel. i implemented the valueChangeListener but this is not called (because I don't submit anything). so I use an a4j:support which calls and action event listener. However, I can obtain th HtmlComboBox in this listener, but I can't get the selected value. The result of htmlCombobox.getValue is always the item selected before the new one.

       

      So I switched over to rich:inplaceSelect but here it is the same

       

      <rich:layoutPanel position="right" width="50%" height="100%">
           <rich:inplaceSelect value="#{wizardBean.selectedDestEntityItemName}" defaultLabel="#{wizardBean.selectedDestEntityItemName}">
                <f:selectItems value="#{wizardBean.destEntityItems}"/>
                <a4j:support event="onchange" immediate="true" ajaxSingle="true" reRender="treedstproperties,detailcontrols"

                          actionListener="#{wizardBean.destEntityChangeListener}"/>
           </rich:inplaceSelect>
      </rich:layoutPanel>

      and the backing bean has

       

      public void destEntityChangeListener(ActionEvent event){
           log (3, "DEST ENTITY CHANGED");
           UIComponent comp = event.getComponent();
           Object obj = comp.getParent();
           if (obj instanceof HtmlInplaceSelect) {
                HtmlInplaceSelect select = (HtmlInplaceSelect) obj;
                log (3, "DEST ENTITY CHANGED = " + select.getValue());

           }
      }

       

      this value is NOT the last selected value.

       

      Can anyone help me here ?

       

      cheers,

       

      Rudi Welter