2 Replies Latest reply on Aug 23, 2010 2:24 PM by Diego Y K

    Blocking concurrent calls

    Diego Y K Newbie

      Hi everyone,

      In my login page I added a rich:hotkey to submit the login action when the user hits the return button.

      Everything was working OK but now I've added a s:token to my login form to prevent CSRF.

      Everything was working ok but I decided to test what happens when the user hits twice the Return button and for my displeasure the system crashed.

      I've tried to put ignoreDupResponse true, but nothing. I'm wondering if there is a way around this problem or if it's just a wrong usage by my part.

      <a4j:form id="loginForm">
           <a4j:outputPanel ajaxRendered="true">
           <div style="width: 160px">
                Login <h:inputText value="#{credentials.username}" id="login" required="true" />
                Password <h:inputSecret value="#{credentials.password}" id="password" required="true" autocomplete="off"/>
                     <a4j:commandButton ignoreDupResponses="true"
                          styleClass="loginLoginButton"  id="loginButton"
                          action="#{identity.login}" value="#{labels['login.loginButton']}"/>
                     <rich:hotKey selector="#loginForm" 
                          key="return" handler="#{rich:element('loginButton')}.onclick();return false;" />
                     <input type="button" id="closeButton" 
                          class="loginCancelButton" onclick="window.close();" value="#{labels['login.closeButton']}"/>

        • 1. Re: Blocking concurrent calls
          Leo van den berg Master


          You can use the s:defaultaction tag inside the button, This makes the login button trigger whenever you hit the enter. The second part is disabling the button while its processing. This can be solved by using a small modalpanel when the system is processing-

          <a4j:commandButton id="restoreButton" 
               reRender="growl,resultTable, pagingPanel "
               oncomplete="#{rich:component('waitPanel')}.hide();" />

          And the waitpanel:

          <h:form id="waitForm" >
          <rich:modalPanel id="waitPanel" autosized="true" domElementAttachment="form" >
               <h:graphicImage value="/images/wait30.gif" />

          Hopefully this helps,


          • 2. Re: Blocking concurrent calls
            Diego Y K Newbie

            Thanks for the reply, it really helped me with another thing but this bug that I'm having is related to this one. I was mistaken saying it was caused by concurrent calls actually the problem was another.


            The link above has a fix for the issue that I'm facing right now. There is a code to fix the clientUIDGenerator, after implementing that my form started to work normally.