Search code examples
javascriptfirefoxformsfirefox-3

Is there any way to stop Firefox from submitting a form on a Javascript error? Maybe in about:config?


Is there any way to stop Firefox from submitting a form on a Javascript error?

I mean I know I can use an alert box or firebug to stop it from doing so, but...not all pages that people work on work with Firebug, and that alert box is just annoying...

Maybe there's a setting in about:config? I could twiddle with?


Solution

  • Create a function that returns true (no errors) or false (some error). Add a submit handler to your form:

    <form [..] onsubmit = "return yourFormCheckfunction();">
    

    Now, if 'yourFormCheckfunction' returns false, your form is not submitted.