473,388 Members | 1,209 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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 5926
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stuart Wexler | last post by:
Hi, I have a form with onSubmit embedded in the <form> tag. The form is submitted programatically through javascript . While the form submits fine, nothing I'm doing seems to get it to...
3
by: n3mtkj3mzsir0cy | last post by:
I have created web pages that do client-side form validation using the onclick directive. E.g., <form action=other_page.cgi method=post> Enter your age: <input name=age> <input type="submit"...
0
by: Mr. SweatyFinger | last post by:
This form has a file upload feature which works in other browsers, but not in safari is the form type wrong? or what is really the deal <form name="aspnetForm" method="post"...
5
by: luckydenis2007 | last post by:
I am trying to access image information that is displayed using iframe. iframe code looks like this: <iframe id="testImage" src="/images/someimg.gif" scrolling="yes" frameborder="0"...
10
by: Tim Streater | last post by:
I have a form and a button to submit it. The button is made from: <input type=button onclick='myHandler(this.form);'> This all works fine except that in Safari 2.0.4, the enter/return keys, if...
8
by: Mark Livingstone | last post by:
I have a form that uses the following: onSubmit="some_var = 'validated';" FireFox is OK with that. Internet Explorer isn't. any ideas why? Thanks.
1
by: Jacqui | last post by:
Hi, I am trying to write a webpage that has a form on it, which gets submitted when a button is pressed, but also has an onclick event which does some DOM manipulation to display a waiting page....
2
by: rudiedirkx | last post by:
Gents, I have a problem (only in Safari) with the onsubmit in webforms. This topic covers the same subject: http://bytes.com/topic/javascript/answers/166542-onsubmit-safari but not as detailed as...
2
semanticnotion
by: semanticnotion | last post by:
I have problem with this code. it work in chrome and safari but in Mozila and IE when i clicked the submit button without filling the fields it will submit the form and move to other page. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.