Today I was emailed by a colleague asking how my team prevents duplicate form submissions (double clicking a button, pressing enter twice on text field, etc.) on the web.
I tried to come up with a robust and simple solution and I wrote the following jQuery snippet in an email response:
1 2 3 | |
It seems simple enough to work, and I tested it in Firefox, Chrome, and IE7/8 and it did seem to do the trick.
However, I haven’t fully tested it. I expect problems on pages that involve ajax requests and rely on multiple submissions without actually refreshing the form.
But for now, it seems to be working. Anyone have a better solution?