Websites for sale:
Web Hosting Reviews and Rating, Used Cars for Sale and Car Sale.
If interested please send my an email at ken@kensfi.com. Thanks!

Javascript: onsubmit skipped

I did a small form for a payment gateway and needed onsubmit method, so I wrote one and test it. Tests failed in FF but worked in IE, no errors, nothing, only one thing: onsubmit method was skipped by JS Engine in FF.

My original code:

<form action="some_link" onsubmit="some_method()">
</form>

Error? Yeah, a return in front of some_method!

<form action="some_link" onsubmit="return some_method()">
</form>

It’s an old trick, but some people(like me) still forget it :).
Why is return needed? Sends the return value to the browser, if it’s FALSE, nothing happens, if TRUE a submit is coming.

Popularity: 1% [?]

If you enjoyed this post, make sure you subscribe to my RSS feed!

Post to Twitter Post to Digg Post to Facebook

Related Posts

Tips and tricks

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

ss_blog_claim=a60fe0ab4bb2f93087f423c86b8d54f3

Leave Comment

(required)

(required)