views:

279

answers:

2

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?

+1  A: 

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

Guffa
+1  A: 

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.

KooiInc
Ah yes, so a try-catch is in order...
leeand00