4 Replies Latest reply on Jun 10, 2011 4:06 AM by rav pad

    Actionlistener in a4j:support not getting triggered

    rav pad Newbie

      Hi,

      My requirement is to create dependent select boxes i.e one change of one combobox the other should be triggered. I wanted it do thru ajax and so I used richfaces to do it. But no matter how hard I try I am not able to get the actionListener method to be triggered

       

      Following are the details

      Myfaces - 2.0.3

      Richfaces - 3.3.1GA

      Weblogic - 10.3

      Facelets - 1.1.15

      The code in .xhtml page is

      <t:panelGroup style="width:200px">

              <rich:comboBox value="#{AssetClassEntitlementBean.classificationTypeId}" id="classificationTypeId">

               <f:selectItems value="#{AssetClassEntitlementBean.classificationTypeList}" /> 

                <a4j:support event="onchange" reRender="classificationId" actionListener="{AssetClassEntitlementBean.getTest}">

               </a4j:support>

               <a4j:log level="ALL" popup="false" width="400" height="200"/>

              

              </rich:comboBox>    

             </t:panelGroup>

             <t:panelGroup style="width:200px">        

                     <h:selectOneMenu id="classificationId" value="#{AssetClassEntitlementBean.classificationTypeId}">        

                <f:selectItems value="#{AssetClassEntitlementBean.classificationTypeList}" />

               </h:selectOneMenu>

             </t:panelGroup>

       

      The code in the bean is

       

      public void getTest(ActionEvent ae){

           System.out.println("test");\\ This does not get printed when I make the change in the first textbox

      }

        • 1. Re: Actionlistener in a4j:support not getting triggered
          Juan Gomez Newbie

          Try  using a a4j:region.

           

          sample:

           

           

          <t:panelGroup style="width:200px">

               <a4j:region>

                  <rich:comboBox value="#{AssetClassEntitlementBean.classificationTypeId}" id="classificationTypeId">

                   <f:selectItems value="#{AssetClassEntitlementBean.classificationTypeList}" /> 

                    <a4j:support event="onchange" reRender="classificationId" actionListener="{AssetClassEntitlementBean.getTest}">

                   </a4j:support>

                   <a4j:log level="ALL" popup="false" width="400" height="200"/>
                  </rich:comboBox> 

             </a4j:region>  

                 </t:panelGroup>

                 <t:panelGroup style="width:200px">        

                         <h:selectOneMenu id="classificationId" value="#{AssetClassEntitlementBean.classificationTypeId}">        

                    <f:selectItems value="#{AssetClassEntitlementBean.classificationTypeList}" />

                   </h:selectOneMenu>

                 </t:panelGroup>

          • 2. Re: Actionlistener in a4j:support not getting triggered
            rav pad Newbie

            HI Juan,

             

            But ths doesnt work. I had already tried ths and tried it again nw but still ActionListener method doesnt get triggered. I have absolutely no idea what the issue could be.Have to say tht richfaces is not as straightforward as it has been projected. This is supposed to be a very simple requirement but it has already cost me a day.

            • 3. Re: Actionlistener in a4j:support not getting triggered
              liumin hu Master

              hi,

               

              Is there any validation error? any js error? All 6 phase of lifecycle is complete?

              • 4. Re: Actionlistener in a4j:support not getting triggered
                rav pad Newbie

                I know ths sounds extremely funny but I resolved this and I m banging my head in the wall rite nw. The solution for this is to move the a4j:support line next to the h:selectOnemenu line.I dont know how this resolved this issue but it did the trick.

                Thanks Juan & Liumi.Appreciate ur help