Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Mutliple User Clicks

Status
Not open for further replies.

scohan

Programmer
Dec 29, 2000
283
0
0
US
I'm working with an <input image ... > tag where I'm able to click the button multiple times before the next page is displayed. This has adverse effects because certain actions are repeated (e.g. creating a file on the user's PC.) The action has to occur one time only.

Is there a way that I can trap when the user clicks the button the first time and disable to button before the user can click it again. Perhaps that's impossible and I may need to set a flag and check it in subsequent code (i.e., if already_clicked_flag = yes don't execute following code) Thanks.
 
how 'bout just eliminating the button, after its pressed the first time??? presumably, if you're creating files, etc you're probably executing some ASP or jscript code then redisplaying the page. you could either &quot;not display&quot; the button the next time you display the page, or you could change its &quot;onclick&quot; function to be one that puts up a dialog box that says &quot;sorry, charlie...&quot;. (of course, if you do this, you might want to also change the text on the button - to something like &quot;don't press this again&quot; :)
 
Not exaclty. The second page is doing the work, but hasn't displayed yet. What I did was go the variable where I bump up the count by one and check in a submit function. If it's > 1 then I don't submit. Seems to work pretty good.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top