0

Currently we are using and My goal is to prevent system from double click problem and also gives users a sign that system is in process - because system is gonna calculate lots o things after user clicks that h:commandButton.

Button Code:

<h:commandLink styleClass="ux_link_text" 
               action="Account" value="Account Info" 
               target="_blank" />

Please advise me on this.

Konstantin Yovkov
  • 62,134
  • 8
  • 100
  • 147
Vikas
  • 127
  • 1
  • 7
  • 16

1 Answers1

0

You can use setTimeout in the onclick property of the <h:commandbutton>. This will disable the button 100 milliseconds after being clicked and the action invoked.

<h:commandLink styleClass="ux_link_text" 
               action="Account" value="Account Info" 
               target="_blank"                
               onclick="setTimeout(this.disabled = true;, 100);"/>

More info:

Community
  • 1
  • 1
Konstantin Yovkov
  • 62,134
  • 8
  • 100
  • 147
  • @kocko..I will test it and let you know. One more thing, Can we also make other links disable on the same screen by setTimeout? I mean to say that If I have two link and whenever I click any link, than selected link and other remain disable. – Vikas Oct 23 '13 at 13:09
  • Yes, ofcourse. You can create a JavaScript function for the purpose, where you will find the components you want to disable by their id then disable them. – Konstantin Yovkov Oct 23 '13 at 13:11