2 Replies Latest reply on Jul 8, 2007 1:58 AM by Tony Mai

    How to fire an AJAX event when h:selectOneMenu changes

    Tony Mai Apprentice

      Hello all,

      Somehow I am not able to get AJAX to fire an event when h:selectOneMenu changed. I have another AJAX support on the same page for a h:inputText and that seems to work just fine.

      This code works just fine:

      <a4j:region id="symbolReg">
       <h:inputText id="symbol" styleClass="#{wcNewOrderMgr.symbolInvalid ? 'editError' : ''}" value="#{wcNewOrderMgr.symbol}" >
       <a4j:support event="onblur" actionListener="#{wcNewOrderMgr.getLastQuote}" reRender="quote" />
       </h:inputText>
       <a4j:status for="symbolReg">
       <f:facet name="start">
       <h:graphicImage value="/img/spinner.gif" />
       </f:facet>
       <f:facet name="stop">
       <h:graphicImage value="" />
       </f:facet>
       </a4j:status>
      </a4j:region>
      


      This code does not work:
      <a4j:region id="acctIdReg">
       <h:selectOneMenu id="acctId" value="#{wcNewOrderMgr.orderAcctId}" >
       <s:selectItems value="#{wcNewOrderMgr.accountIds}" var="aId" label="#{aId}" >
       <a4j:support event="onchange" actionListener="#{wcNewOrderMgr.getPortfolioIds}" reRender="newOrder" />
       </s:selectItems>
       </h:selectOneMenu>
       <a4j:status for="acctIdReg">
       <f:facet name="start">
       <h:graphicImage value="/img/spinner.gif" />
       </f:facet>
       <f:facet name="stop">
       <h:graphicImage value="" />
       </f:facet>
       </a4j:status>
      </a4j:region>


      Question: What AJAX event do I need to listen to invoke a server method when user changed a select item?

      Thanks
      -tony