Reputation: 25329
I am trying to disable the form on my site when the user click the submit button to stop duplicate submissions. Due to there being an input type file on the form the upload can take a while. So far I have tried this
$("#uploadForm").submit(function () {
$(":input", this).attr('disabled', 'disabled');
});
The trouble is that this stops the form sending any data to the web server. Is there some way to disable the form and still have it post the data.
Upvotes: 1
Views: 272
Reputation: 841
Let it do the submit before disabling:
$("#uploadForm").submit(function () {
setTimeout(function(){$("#uploadForm :input").attr('disabled','disabled');}, 10);
return true;
});
Upvotes: 3
Reputation: 1260
how about using a progress bar when submit is clicked..
http://plugins.jquery.com/project/loading
Upvotes: 1
Reputation: 1586
I wouldn't disable the input button, this is confusing for the user. I would just overlay the form with a "Uploading.." message. See jQuery BlockUI plugin.
Upvotes: 1