473,545 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page Submits Twice

Hi

Here is the sample code for my form, but problem is that it submitts
twice in some cases when i click sub mit button.
<script>
function validateform (){
//do a lot validation here, if validation failes, return false;

//finaly this line
return true;
}
</script>

<form name="abc" action="any other apge" onsubmit = "return
validateform(); ">

<input type="submit" name="save" id="save">
</form>

Can any one help me?

Feb 24 '06 #1
5 2422

Umesh wrote:
Hi

Here is the sample code for my form, but problem is that it submitts
twice in some cases when i click sub mit button.
<script>
function validateform (){
//do a lot validation here, if validation failes, return false;

//finaly this line
return true;
}
</script>

<form name="abc" action="any other apge" onsubmit = "return
validateform(); ">

<input type="submit" name="save" id="save">
</form>

Can any one help me?


You need to ask this in a javascript forum. It's a client side problem
- ASP is purely server side.

/P.

Feb 24 '06 #2
Any way! thanks for suggestion

Feb 24 '06 #3
<script>
var isSubmitted = false;
function validateform (){
//do a lot validation here, if validation failes, return false;
//finaly this line
if (!isSubmitted)
isSubmitted=tru e;
return true;
else
return false;
}
</script>

<form name="abc" action="any other apge" onsubmit = "return validateform(); ">
<input type="submit" name="save" id="save">
</form>
Feb 25 '06 #4
Hi ! Thanks for your time.

I am not able to understand why this probelm occured. can u elaborate
more.

**Note submit button is clicked only once.

Feb 25 '06 #5
dNagel wrote on 25 feb 2006 in microsoft.publi c.inetserver.as p.general:
if (!isSubmitted)
isSubmitted=tru e;
return true;
else
return false;


=== Do not forget the {}

....
if (!isSubmitted) {
isSubmitted=tru e;
return true;
}
else
return false;
....

=== why use "else":

....
if (!isSubmitted) {
isSubmitted=tru e;
return true;
}
return false;
....

=== why use an "if":

....
var x = isSubmitted
isSubmitted = true
return !x
....

;-}

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 25 '06 #6

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

Similar topics

15
4306
by: wk6pack | last post by:
Hi, I have a problem and not quite how to go about solving it. I have a form written in asp. I wish to submit the form and have the server return back to the same page without actually refreshing the page. I know I could write a form, submit it and go to another page. I've searched the web and I see something about HTTP Status code...
3
2296
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I need to: 1. Click a submit button on an asp page, calling another page that saves the contents of that form to a database and then displays
1
8456
by: Frawls | last post by:
Hi Can any one give me some help with this problem please? Here is the scenario: A user submits page 1 which is a web form. After the form has been submitted they are (redirected) onto the next page, page 2.
2
3834
by: Frawls | last post by:
Hi Can any one give me some help with this problem please? Here is the scenario: A user submits page 1 which is a web form.
0
1252
by: Jesper Lauridsen | last post by:
I am developing an ASP.NET application for a Questionnaire that spans over several pages. The entire Questionnaire code resides in one ASPX page. When a user submits a questionnaire page by clicking a "Next page" button, I want to 1) validate the answers and 2) render the next page (but still the same ASPX page) if the questionnaire page...
7
2021
by: Tom wilson | last post by:
I have created a very simple example that doesn't work. Form1 contains a textbox and a button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Response.Redirect("login.aspx") End Sub Very simple. Forget what login.aspx does, it's just somewhere to redirect to.
8
2753
by: TS | last post by:
Hi, i have inherited a page from another user. The page is the target frame in a frameset. for some reason the whole page runs twice (page_load, init, etc. all run twice) I can't figure out how this is happening. there are no transfers or redirects that are occurring in the pages. the page runs thru all of its events then starts all over...
2
1806
by: Zubair.NET! | last post by:
Hi, I am working on somebody else's code built in ASP.NET/C#, during some of the request, ASP.NET Pages refreshes twice unexpectedly. My application runs in an IFrame with a LHS navigation tree, I am passing querystrings using javascript on a HTML button control, which results in performing different operations on querystring. Button:
4
2816
by: Scott Shuster | last post by:
Hi, I've been searching and testing and have not yet found the answer I'm looking for. I have an ASP.NET (vb) application with an ecommerce function. When the user submits the page, I DON'T want them to be able to click on the 'BACK' button and get back to the form - they may inadvertently re-submit the page and get charged again. I...
0
7484
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7415
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7675
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7928
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7440
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5997
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.