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

StackOverflow https://stackoverflow.com/questions/571502

Question

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?

Was it helpful?

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top