469,623 Members | 1,371 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

onsubmit() with Safari

Hi,
It seems that unlike other browsers, Safari will submit a form even
when the onsubmit event handler returns false. e.g. <form
onsubmit="return false" ...>

Is there a workaround to prevent the form being submitted?

Thanks,
JM

Oct 8 '05 #1
2 5631
JM Rosengard wrote:
Hi,
It seems that unlike other browsers, Safari will submit a form even
when the onsubmit event handler returns false. e.g. <form
onsubmit="return false" ...>

Is there a workaround to prevent the form being submitted?


First ya gotta prove that what you claim actually happens. For me in
Safari 1.0.3 the following form does not submit:
<script type="text/javascript">

function doSubmit(f){
alert('the onsubmit fired');
return false;
}
</script>
<form action="" onsubmit="return doSubmit(this);">
<input type="text" value="Change me and submit...">
<input type="submit">
</form>
But maybe you are submitting the form or trying to cancel submit some
other way?

--
Rob
Oct 9 '05 #2
Hi,
There are several reports on the web of this happening with Safari but
maybe this has been changed recently?
From my web server's log, the problem occurs at least for:

Safari/412.5
Safari/125.12
Safari/312.3.1

The version numbers mentioned are the one appearing in the user agent
field of HTTP requests.

Thanks

The code I am referring to is similar to Rob's.

Thanks

Oct 9 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Stuart Wexler | last post: by
reply views Thread by Mr. SweatyFinger | last post: by
5 posts views Thread by luckydenis2007 | last post: by
10 posts views Thread by Tim Streater | last post: by
8 posts views Thread by Mark Livingstone | last post: by
1 post views Thread by Jacqui | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.