5 Replies Latest reply on Apr 5, 2007 5:54 AM by damatrix

    Help! A4JSF a:support problem

    damatrix

      Hello,

      I'm using seam 1.2.1.GA, and ajax4jsf. Following the booking example, I have an actionListener attached to an "onblur" event on an a:support tag as follows

      <s:decorate id="titleDecorate" template="../templates/edit.xhtml">
       <ui:define name="label">Title </ui:define>
       <h:inputText id="title" value="#{fairManager.objectTitle}" required="true">
       <a:support event="onblur" actionListener="#{fairManager.checkTitle}" reRender="titleDecorate"/>
       </h:inputText>
      
      </s:decorate>
      


      The "fairManager" here is a CONVERSATION scoped stateful session bean. When i debug, i find that the "fairManager.checkTitle" method is never called. The method is specified on the interface as all methods should. Is there any reason why it shouldn't work? I have a similar actionListener on a SESSION scoped SFSB, and it works alright. I don't know why this one doesn't.


        • 1. Re: Help! A4JSF a:support problem
          pmuir

          Does the action listener work if attached to a commandLink/button?

          • 2. Re: Help! A4JSF a:support problem
            damatrix

            Yes. I tried it on a commandbutton and the action listener works. Any ideas?

            • 3. Re: Help! A4JSF a:support problem
              dd_la_frime

              What is the signature of the method checkTitle() in your component fairManager ?

              If I remember, Ajax4JSF wrote in its taglib javadoc that actionListener attribute can call a method if and only if this method returns void.

              Is it the case with your method ?

              Christophe

              • 4. Re: Help! A4JSF a:support problem
                christian.bauer

                I'm doing the same but I'm using the action= attribute, not actionListener=, and it works:

                 <s:decorate id="emailDecorate">
                 <div class="entry">
                 <div class="label">E-Mail:</div>
                 <div class="input">
                 <h:inputText tabindex="3" size="40" maxlength="255" required="true"
                 id="email" value="#{userHome.instance.email}">
                 <a:support event="onblur" reRender="emailDecorate"/>
                 </h:inputText>
                 </div>
                 </div>
                 </s:decorate>
                
                 <s:decorate id="usernameDecorate">
                 <div class="entry">
                 <div class="label">Username:</div>
                 <div class="input">
                 <h:inputText tabindex="4" size="16" maxlength="16" required="true"
                 id="username" value="#{userHome.instance.username}">
                 <a:support event="onblur" action="#{userHome.validateUsername}" reRender="usernameDecorate"/>
                 </h:inputText>
                 </div>
                 </div>
                 </s:decorate>
                
                


                • 5. Re: Help! A4JSF a:support problem
                  damatrix

                  To answer the first question on the signature, it returns void with no input parameters.

                  I tried the suggestion of the "action" attribute, and find that the method is called only after
                  1. I have filled all the other required fields on the form AND
                  2. I come back to that field again and it loses the focus.

                  It's never called right after the input field loses focus. I tried the "immediate=true" attribute on the a:support and the method was called immediately focus moved from the input field, however the value input in that field is not bound to the object being populated, so in effect i get a null. Could there be a problem somewhere in my configurations etc?