2 Replies Latest reply on Jul 21, 2009 4:35 PM by Nikos Paraskevopoulos

    strange behaviour of onchange event

    Jaime Martin Apprentice

      I have a selectOneMenu that has a default option by means of a f:selectItem and several options by means of f:selectItems.
      It works ok. I want an action to be fired when the user selects a different option. I´ve done it with a4j:support event onchange without problem.
      The matter is that I have tested that the event is not fired when you choose the f:selectItem option, and it works ok whenever you choose some of the values provided by the f:selectItems.
      This is the code:


                  <s:decorate id="domBuySellSei" template="layout/edit.xhtml"  
                  rendered="#{internationalOrderManager.getSettlementInstructionsList().size() ne 0}">
                          <ui:define name="label">#{messages['view.SettlementInstruction']}</ui:define>
                          <h:selectOneMenu id="counterpart" value="#{internationalOrderManager.settlementInstruction}"
                              required="true"
                              label="#{messages['SettlementInstruction']}">
                              <f:converter converterId="boleta.SettlementInstructionConverter" />
                              <f:selectItem itemLabel="--- Please select an option ---"
                                  />
                              <f:selectItems value="#{internationalOrderManager.getSettlementInstructionsItems()}"/>
                              <a4j:support event="onchange"
                                  action="#{internationalOrderManager.setDefaultSettlementInstruction()}"
                                  reRender="infoSetIns,editableSetInsField,update" ajaxSingle="true" />
                          </h:selectOneMenu>
                  </s:decorate>
      




      Imagine that



                              <f:selectItems value="#{internationalOrderManager.getSettlementInstructionsItems()}"/>
      


      returns ten options. If I select one of them, the event is fired, but when I select Please select an option nothing happens, and action defined in the a4j:support event onchange is not launched.
      any idea?