By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,569 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,569 IT Pros & Developers. It's quick & easy.

onsubmit() with Safari

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.