This web site is hosted on the very slow server and the consequence is that the rebuilding of files takes forever, sometimes up to 1 minute. :’(
Side-effect of this is that, when you submit a comment, it appears that nothing is happening (except the upper right browser icon is rotating) so you naturally click again and again and it sometimes posts the same comment several times. I’m not able to repeat that (which puzzles me), but I have seen it happen (and spent time deleting identical comments).
So, to save my self some time, I changed MT comment handling script. I added this into form tags on entry comment template (as well as on comment listing, preview and error templates):
onsubmit="return SubmitComment(this)"
and this is the SubmitComment function:
function SubmitComment(oForm) {
if (oForm.submitClicked) {
alert("Form is submitted, processing »
will take a bit (it is a slow server :( )");
return false;
}
oForm.submitClicked = true;
if (oForm.bakecookie)
if (oForm.bakecookie[0].checked)
rememberMe(oForm);
return true;
}
It is very simple DOM trick: property submitClicked is added to form object and later on checked, so if you click more than once you’ll be notified and that second (third etc.) submit will be canceled.
bakecookie thing is from original MT build.





The downside of this method is when a http request is lost on internet (from the browser perspective, the request times out, it does happen sometimes), the user can’t resubmit the form.
Copying the data, reload the page, paste the data and submit is the only option for that situation.
One way of addressing that isue would be starting a timer, but the request can’t be cancelled as far as I know. Do you have any ideas?
Good point.
Problem is how to reliably detect that request has failed? Nothing that comes to mind… If we could detect that, than it’s easy to reset the property.
Other solution would be to place another button like “Resubmit”, which can be hidden until the user clicks on the Submit and something like 5-10s pass. If request don’t pass through in that time, function will execute and show that button.
Or better yet, the message that pops up can contains something like this:
“Form is submitted, processing will take a bit (it is a slow server :( ).\n\nIf in 10s you are still waiting for submit to finish, try resubmiting again.”
On form submit you do setTimeout(“enable()”, 8000) and let it work. You can even track down the number of passed seconds and display appropriate message to the user. It’s all about your decision — is it worthwhile or is it overkill.
I suggest a little more elegant method. You can disable the “Submit Comment” button once clicked. Then, you can put in the text of the button something like “If page don’t reload press F5”.