Usually, submit buttons in web forms should be clicked just once; but many users click them twice or more. Why?
- Because they’re used to launch actions by double clicking (as on Windows icons).
- Because the server doesn’t replies instantantly, and they click again “just to see if something happens”.
What’s the result? The form data is sent twice to the server, and users usually don’t realize it; they just get the response to one of the submits. Try this simulation to see what happens when submitting several times the form before the server response arrives:
This is not a big issue if it’s, for instance, a search form: the query is being launched twice but the user simply gets the result. It may be annoying if someone is receiving the same mail several times just because users are submiting several times the contact form. And it’s a real big problem when the user is submiting a payment (you can be pretty sure they don’t want to pay twice the same object!).
There’s an easy solution for that problem! Simply disable the button just after the form is submitted, and you can change the button text too. The result is something like this:
This is done using the
onsubmit form event:
<form onsubmit=document.forms['formname'].submitbutton.disabled=true; document.forms['formname'].submitbutton.value='Sending...';" action="action" name="formname"> <!-- some form controls here --> <input value="Send" name="submitbutton" id="submitbutton" type="submit"> </form>
With this technique, you achieve two positive effects:
- avoiding the double submit problem; and
- giving feedback to the user confirming the submit
It’s really simple to use and without negative effects. Try it if you are really tired of multiple submits and tell me how it goes!