How to handle multiple submit button clicks?
-
I know I'm missing something simple here, but what's the cleanest way to handle impatient users who think they need to click a "submit" button over and over again on a web form? On some of my pages, this causes multiple transactions to be sent to my database. :mad: Currently, I have an ugly bit of JavaScript that hides the button once it's clicked (via a DHTML behaviour). I tried setting the "disabled=true", but then the Form is never submitted. :confused: Thanks for your advise. Barry Etter
-
I know I'm missing something simple here, but what's the cleanest way to handle impatient users who think they need to click a "submit" button over and over again on a web form? On some of my pages, this causes multiple transactions to be sent to my database. :mad: Currently, I have an ugly bit of JavaScript that hides the button once it's clicked (via a DHTML behaviour). I tried setting the "disabled=true", but then the Form is never submitted. :confused: Thanks for your advise. Barry Etter
Add an onsubmit handler to the form that checks a variable to see if the form has been submitted before. If it has, just cancel the submit event buy setting the event.returnValue = false in IE, for Netscape - I thinkyou just return false within the event handler.