A poorly written internal system that we interact with has problems handling the load we produce. Although they fix the load problems, we are trying to reduce any additional load that we generate, one of which is that the internal system continues to try to service the form submission, even if the other submission comes from the same user.
We noticed that users double-click on the form submit button. I need to disable these clicks and prevent the submission of the second form.
My approach (using Prototype) is putting onSubmitin a form that calls the following function, which hides the submit button of the form and displays "loading ..." div.
function disableSubmit(id1, id2) {
$(id1).style.display = 'none';
$(id2).style.display = 'inline';
}
The problem I found with this approach is that if I use an animated gif in "loading ..." div, it loads normally, but doesn’t enliven while the form is submitting.
Is there a better way to do this debacking and continue showing the animation on the page, waiting for the form result (finally)?
source
share