1 Reply Latest reply on Oct 14, 2011 8:26 AM by Christian Peter

    not allow the user click more than once in a4j:commandButton

    andesouza86 Newbie

      Hi Guys,

       

      How do I not allow the user click more than once in an a4j: commandButton?

       

      I tried this:

       

      <a4j:commandButton id="btnProg"

                action="#"

                image="../../images/add.png"

                styleClass="tdBtn"

                style="width:65;height:18;cursor:hand">

                <a4j:support event="onclick"

                          action="#{cvView.addProg}"

                          oncomplete="#{messageView.onComplete}"

                          reRender="pnlError,pnlAlert,pnlException,idPanelFormDados,

                          idPanelForm,idladoDireito,idDtExp,idDtForm,idDtCurso,idDtIdioma,

                          idDtCert,idPanelUploadEsq,idPanelUploadDir"/>

      </a4j:commandButton>

       

       

      But not work.

        • 1. Re: not allow the user click more than once in a4j:commandButton
          Christian Peter Expert

          Is there any particular reason why you're using an a4j:support inside an a4:commandButton? All those features are already provided by the button as far as I know.

           

          You could try this 'hack':

           

          <a4j:commandButton value="addToFavourites"

                  onclick="this.disabled=true;"

                  oncomplete="alert('helloworld');"       

                  action="#{favouriteHandler.addToFavourites}"/>

           

           

          --> onclick="this.disabled=true;"