Instead of trying to disable every element that can trigger a form
submission, I stop the form submission event itself. Here is the JavaScript
I have been using, and it seems to be working for me:
document.observe("dom:loaded", function() {
$$("form").invoke("observe", "submit", function(event) {
if (this.submitted) {
event.stop();
} else {
this.submitted = true;
};
});
});
Benny
On Fri, Dec 10, 2010 at 2:43 PM, David Rees <[email protected]> wrote:
> On Thu, Dec 9, 2010 at 2:57 PM, Benny Law <[email protected]> wrote:
> > Keep in mind that a form could be submitted by pressing the Enter key
> inside
> > a text field. A safer approach would be to prevent the form itself from
> > being submitted more than once, regardless of how it is submitted.
>
> Right - and as I stated in my original post I tried disabling the link
> by observing the FORM_PREPARE_FOR_SUBMIT_EVENT event - but for some
> reason you can't disable the link like you can a button...
>
> I also tried using a Javascript variable to see if the form had been
> submitted once already or not, but I was not able to get the event to
> stop...
>
> -Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>