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

2.8k Views Asked by At

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?

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On

Submit the form using Javascript. That way if the script fails, it never gets to the line where it submits the form.