6 Replies Latest reply on Aug 28, 2009 6:54 AM by johndoe123

    h:selectOneMenu and a4j:support

      Hi,

      I'm having a problem to add js-capability to a h:selectOneMenu tag.
      What I'm trying to reach is that if a user chose one entry from a dropdown and leave this field another field shoud be updated.

      Thats my code:

      <h:selectOneMenu id="nummer" value="#{mb.nummer}" onblur="#{fonds.updateName}">
       <a4j:support event="onblur" actionListener="#{mb.updateName}" reRender="name" />
       <f:selectItems value="#{mb.listeNummer}" />
      </h:selectOneMenu>
      <h:selectOneMenu id="name" value="#{mb.name}">
       <a4j:support event="onblur" actionListener="#{mb.updateNummer}" reRender="nummer" />
       <f:selectItems value="#{fonds.listeName}" />
      </h:selectOneMenu>
      


      Neither the onblur function at the selectOneMenu nor the a4j:support tag takes any effect.

      But if I try the same with inputText there is no problem.

      Does anybody has an idea? Is there at least a chance to combine a selectOneMenu tag with js-capability?
      Thanks in advance.

        • 1. Re: h:selectOneMenu and a4j:support

          Which browser are you using? Have you considered using the onChange event?

          • 2. Re: h:selectOneMenu and a4j:support
            ilya_shaikovsky

            1) remove onblur from componet. Both definitions support and event attribute will not works.
            2) add ajax single to both supports.

            example present at livedemo support page.

            • 3. Re: h:selectOneMenu and a4j:support

               

              "JohnDoe123" wrote:
              Which browser are you using? Have you considered using the onChange event?


              I tried it with the IE8 and Firefox 2.0.0.3.
              I also tried the onchange event....no effect :(


              • 4. Re: h:selectOneMenu and a4j:support

                 

                "ilya_shaikovsky" wrote:
                1) remove onblur from componet. Both definitions support and event attribute will not works.
                2) add ajax single to both supports.

                example present at livedemo support page.


                I extended my Code about the ajaxSingle attribute but without any effect.
                This is my new code:
                <h:selectOneMenu id="nummer" value="#{mb.nummer}">
                 <a4j:support event="onblur" actionListener="#{mb.updateName}" reRender="name" ajaxSingle="true" />
                 <f:selectItems value="#{mb.listeNummer}" />
                </h:selectOneMenu>
                <h:selectOneMenu id="name" value="#{mb.name}">
                 <a4j:support event="onblur" actionListener="#{mb.updateNummer}" reRender="nummer" ajaxSingle="true" />
                 <f:selectItems value="#{fonds.listeName}" />
                </h:selectOneMenu>
                


                I also take a look at the example page (http://livedemo.exadel.com/richfaces-demo/richfaces/ajaxListener.jsf?c=ajaxListener) but I don't find any example for this concrete problem.

                • 5. Re: h:selectOneMenu and a4j:support
                  nbelaevski

                  Hi,

                  Try "onclick" event. Are there are any errors in a4j:log for select AJAX update?

                  • 6. Re: h:selectOneMenu and a4j:support

                    That's the way I did it:

                    <td>
                     <h:selectOneMenu id="sortFields" value="#{control.sortOption}">
                     <s:selectItems value="#{control.sortOptionValues}" var="sortItem" label="#{sortItem.label}" />
                     <a4j:support event="onchange" reRender="otherStuff" limitToList="true"/>
                     <s:convertEnum />
                     </h:selectOneMenu>
                     </td>


                    It works in IE 7/8 and Firefox x.