1 Reply Latest reply on Mar 29, 2012 5:01 PM by nt2005

    a4j:commandButton disabled delay oncomplete - How?

    nt2005 Newbie

      Hello Community,

       

      I am using Richfaces 3.3.3 and I like to add a delay to a button after the request is finish. I am not very good in javascript but I tried something like this:

      <a4j:commandButton value="Start" action="#{foo.start}" reRender="panel"
       onclick="this.disabled=true" oncomplete="setTimeout('this.disabled=false;',3500)">
      </a4j:commandButton>
      

      It does not work. the button never get enable again...

       

      What would best:

      rerender when oncomplete is called and after 3-4 secounds the button should enable again. Anyone have an idea?

       

      Thanks in advance.

        • 1. Re: a4j:commandButton disabled delay oncomplete - How?
          nt2005 Newbie

          <a4j:commandButton id="start" value="Start"

                              action="#{foo.start}"

                              reRender="panel"

                              onclick="this.disabled=true" oncomplete="enableStartButton()">

          </a4j:commandButton>

          <a4j:jsFunction name="enableStartButton" ajaxSingle="true" requestDelay="3000" reRender="start"/>

           

          Got it. Thanks anyway.