I have a large form that which is posted using jQuery forms and jQuery validator plugin. The form is quite large and when you push the submit button, it takes some time before anything happens . To prevent people from clicking the submit button multiple times, I am using the following in the document_ready function:
$('#submitbutton').click(function(){
$(this).attr("disabled", "disabled");
$(this).parents('form').submit();
});
This is the button:
<input id="submitbutton" type="button" value="Заказать!" />
This does disable the button, but not immediately, but only just before the submit takes place, which is not what I want. What would be the best way to disable the button immediately?
I had someone clicking the button 5 or 6 times which made a mess (it is a simple order form that I wrote for internal use). With this delay it is hard to take any other measures to prevent the exact same data to be posted over and over on the client side.
Anyway, there should be an elegant way to solve this on the client side too...
For now I can only solve it on the server side. (which should be done anyway).