473,394 Members | 1,878 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,394 software developers and data experts.

Issue with "return false;"

I have a return false as part of my if statement and my form is still submitting.

Here is the simple example. Any suggestions?
if(msg != ""){
alert(msg);
return false;
}else{
//submit the form
}
Jul 23 '05 #1
2 1322
On 26 May 2004 12:10:08 -0700, gachris wrote:
Here is the simple example.
It's probably in the bit you left out..
URL?
..Any suggestions?


Supply an URL,
get regular sleep,
be good to your mother.
(not necessarily in that order) ;-)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2
Lee
gachris said:

I have a return false as part of my if statement and my form is still
submitting.

Here is the simple example. Any suggestions?
if(msg != ""){
alert(msg);
return false;
}else{
//submit the form
}


Most commonly this is because your validation function is returning
false to the onsubmit handler, but the onsubmit handler function
is not returning that value to the browser. The onsubmit handler
is the value of the HTML onsubmit attribute (usually), so instead
of something like:

onsubmit="myValidationFunction(this)"

you should have something like:

onsubmit="return myValidationFunction(this)"

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ItsMillerTime4u | last post by:
I'm trying to change the <body> 's event oncontextmenu attributes, but am having no luck at it. I know I can do <body oncontextmenu="contextMenu(); return false;"> but the thing is that I set's...
1
by: yingjian.ma1955 | last post by:
When I want to disable the select functionality, Can I just use onselectstart="return false"? I tried it and it works. But it seems people always put onselectstart="return false"...
13
by: kurtj | last post by:
Hello Gurus: I have a validation script (below) that is somehow messed up. If the Name field is blank, I get the alert message, then the browser window goes to a blank document with the word...
40
by: Mark P | last post by:
I'm implementing an algorithm and the computational flow is a somewhat deep. That is, fcn A makes many calls to fcn B which makes many calls to fcn C, and so on. The return value of the outermost...
0
by: Dan D. | last post by:
We are running an IIS Server on W2K3 Server. We have 20 or 30 ASP.NET 1.1 applications. Recently I have converted an existing 1.1 application to use the 2.0 framework. After testing and a little...
13
by: alvin.yk | last post by:
Hi, Normally, a piece of code such as <a href="http://www.yahoo.com" onclick="alert('hello');return false;">link</a> will stop the browser from actually going to href's destination....
5
by: Ben | last post by:
Hi; I use ain asp.net the CreateUserWizard control for new users. When it's done, i want to redirect them to another page (modifyprofile.aspx). This works with the code below. My question is:...
0
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm using a URLRewrite module to redirect certain URLs in my .net 2.0 website. However I am getting som really bizarre behaviour public void UrlRewriter_BeginRequest(object sender,...
5
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.