473,378 Members | 1,462 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,378 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 5921
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. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.