Stop Forms in Safari - Execute Javascript

redfrog

Registered
Hello all,

I need to figure out how to stop html forms from being submitted in safari.

I would like some javascript to execute instead of the form being submitted

Any suggestions? More information required?

I could really use some help on this people.. I have been able to get it to work on windows in IE and Firefox but not in Safari or Firefox on OSX..

Kind regards,
redfrog

http://www.gravityworks.us/a.wpblog
 
Instead of using an <INPUT TYPE="SUBMIT">, try <INPUT TYPE="BUTTON">. A button can have an javascript onMouseDown handler and will not submit the form.
 
Actually that won't prevent the form from being submitted. If you had a textbox and press "enter" the form would submit.

Your best bet is to add this to your <form> tag. "onsubmit='doSomething(); return false;'"
 
Thanks peeps..

But this is what I am doing already and it does not work under OSX only windows.. If anyone can give me another option that would be great.

onsubmit="do(); return false"

Thanks, and please any and all information is appreciated.

Kind regards,
redfrog
 
Let's correct your syntax problem. "do" is apparently a reserved word, so you cannot use it as the name of a function. If you want to use a two letter function name try using "go".

I would also suggest that you get a copy (if you don't already have it) of Mozilla. It has a javascript console (to display error messages) and a javascript debugger. They can be a real lifesaver when working with JavaScript.

BTW: Does anyone else think it is fitting that O'Reily's animal for JavaScript is a Rino?
 
Back
Top