|
 |
asp_web_howto thread: Script being executed twice?
Message #1 by "Ryan vd Merwe" <ryan@8...> on Tue, 12 Nov 2002 09:27:34 +0200
|
|
Hi
I wrote an application for a client and was working fine until a few days
ago when certain scripts are being run twice or even three times resulting
in multiple duplicate entries in the database. The delay between the
'reruns' is about 20 seconds. The problem is intermittent and occurs on
different scripts at different times.
My client has a large network that spans different locations around the
country. My client blames me, but I'm sure it is their network...in any
event...has anyone had a similar problem or is there a way that I can
totally prevent my scripts from executing twice.
Thanks
Ryan
Message #2 by "Craig Flannigan" <ckf@k...> on Tue, 12 Nov 2002 09:42:02 -0000
|
|
It depends on how you've built your pages.
We did have this problem a long time back, but this was down to our error.
We placed the Database Insert scripts and Email sending code in one page -
occasionally, if the mail server wasn't responding quickly enough, or the
network was congested - users became impatient and usually hit F5 to reload
the page - trying to speed it up (if only they knew).
This had the problem of running the Database code and email code twice - or
how ever many times they pressed it. Also - users hitting the Back Button
can cause problems like this.
We put code in to prevent them going back to the page which did the insert -
This worked well.
We also moved the Email code to another page so that only one process was
occurring on that page. Normally all this code on one page isn't a problem -
but this email component we used, and inserting into an Access DB wasn't
quick. By moving it, individual page loads improved, although the
application wasn't any quicker overall.
Check your code for loops - are you sure all condition-based code is working
100%? If so - try to install further code to see if the user is re-loading
the page when it's already posting to a DB.
It may not be anything to do with the users, and could be their network
causing issues with the server, but I've never heard of it.
HTH
Craig.
-----Original Message-----
From: Ryan vd Merwe [mailto:ryan@8...]
Sent: 12 November 2002 07:28
To: ASP Web HowTo
Subject: [asp_web_howto] Script being executed twice?
Hi
I wrote an application for a client and was working fine until a few days
ago when certain scripts are being run twice or even three times resulting
in multiple duplicate entries in the database. The delay between the
'reruns' is about 20 seconds. The problem is intermittent and occurs on
different scripts at different times.
My client has a large network that spans different locations around the
country. My client blames me, but I'm sure it is their network...in any
event...has anyone had a similar problem or is there a way that I can
totally prevent my scripts from executing twice.
Thanks
Ryan
_____________________________________________________________________
Please contact I.T. Support if you have received this email in error.
This e-mail has been scanned for all viruses by Star Internet.
_____________________________________________________________________
_____________________________________________________________________
Kingfield Heath Ltd. Email Disclaimer
Confidentiality : This email and its attachments are intended for the
above-named only and may be confidential. If they have come to you in
error you must take no action based on them, nor must you copy or
show them to anyone; please reply to this email and highlight the
error.
Security Warning : Please note that this email has been created in
the knowledge that the internet is not a 100% secure communications
medium. We advise that you understand and observe this lack of
security when emailing us.
Viruses : Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that, in keeping with
good computing practice, the recipient should ensure they are
actually virus free.
_____________________________________________________________________
Message #3 by "John Parlato" <jparlato@m...> on Wed, 13 Nov 2002 20:55:41 -0500
|
|
If the updates are occuring from web pages, you may want to insure that the
code prevents
the update event(submit button) from being pressed multiple times, without
the user even knowing
that he/she has pressed the key multiple times.
You must program to prevent this.
I use two procedures. One, I place code in the java script to prevent this,
and then on the server,
I use some method of checking for a repeat of the same input.
You'll have to look at your own requirements for accomplishing this.
-----Original Message-----
From: Ryan vd Merwe [mailto:ryan@8...]
Sent: Tuesday, November 12, 2002 2:28 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Script being executed twice?
Hi
I wrote an application for a client and was working fine until a few days
ago when certain scripts are being run twice or even three times resulting
in multiple duplicate entries in the database. The delay between the
'reruns' is about 20 seconds. The problem is intermittent and occurs on
different scripts at different times.
My client has a large network that spans different locations around the
country. My client blames me, but I'm sure it is their network...in any
event...has anyone had a similar problem or is there a way that I can
totally prevent my scripts from executing twice.
Thanks
Ryan
Message #4 by "Drew, Ron" <RDrew@B...> on Thu, 14 Nov 2002 07:43:40 -0500
|
|
Preventing multiple submits...
<script language=3D'javascript'>
var submitted=3D0;
function validateForm()
{
if (submitted=3D=3D0)
{
document.testForm.submit();
submitted=3D1;
}
}
</script>
</head>
<body>
<form name=3D'testForm' method=3D'post' action=3D'mycode.asp'
onsubmit=3D'return
validateForm()'>
<input type=3D'text' name=3D'info' size=3D'30'>
<input type=3D'submit'>
</form>
-----Original Message-----
From: John Parlato [mailto:jparlato@m...]
Sent: Wednesday, November 13, 2002 8:56 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Script being executed twice?
If the updates are occuring from web pages, you may want to insure that
the code prevents the update event(submit button) from being pressed
multiple times, without the user even knowing that he/she has pressed
the key multiple times. You must program to prevent this. I use two
procedures. One, I place code in the java script to prevent this, and
then on the server, I use some method of checking for a repeat of the
same input.
You'll have to look at your own requirements for accomplishing this.
-----Original Message-----
From: Ryan vd Merwe [mailto:ryan@8...]
Sent: Tuesday, November 12, 2002 2:28 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Script being executed twice?
Hi
I wrote an application for a client and was working fine until a few
days ago when certain scripts are being run twice or even three times
resulting in multiple duplicate entries in the database. The delay
between the 'reruns' is about 20 seconds. The problem is intermittent
and occurs on different scripts at different times.
My client has a large network that spans different locations around the
country. My client blames me, but I'm sure it is their network...in any
event...has anyone had a similar problem or is there a way that I can
totally prevent my scripts from executing twice.
Thanks
Ryan
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
Message #5 by devsql@c... on Thu, 14 Nov 2002 09:22:22 -0800 (PST)
|
|
Well, I think it depends on the scope of your
application. Sometimes you need to allow user to submit
hundreds of different data on the same window.
I once had an application that allow user to submit
same data. However, I have script in mycode.asp to
check any duplication with the database. If yes,
rollback and display message on new pop up window which
close auto in 3 sec or close by user by clicking close
button. If no, save data in db and close pop up window
auto.
Hope this idea help.
Bill
On Thu, 14 Nov 2002, "Drew, Ron" wrote:
>
> Preventing multiple submits...
>
> <script language='javascript'>
> var submitted=0;
> function validateForm()
> {
> if (submitted==0)
> {
> document.testForm.submit();
> submitted=1;
> }
> }
> </script>
> </head>
> <body>
> <form name='testForm' method='post'
action='mycode.asp'
> onsubmit='return
>
> validateForm()'>
> <input type='text' name='info' size='30'>
> <input type='submit'>
> </form>
>
> -----Original Message-----
> From: John Parlato [mailto:jparlato@m...]
> Sent: Wednesday, November 13, 2002 8:56 PM
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: Script being executed
> twice?
>
>
> If the updates are occuring from web pages, you may
> want to insure that
> the code prevents the update event(submit button) from
> being pressed
> multiple times, without the user even knowing that
> he/she has pressed
> the key multiple times. You must program to prevent
> this. I use two
> procedures. One, I place code in the java script to
> prevent this, and
> then on the server, I use some method of checking for
a
> repeat of the
> same input.
>
> You'll have to look at your own requirements for
> accomplishing this.
>
>
> -----Original Message-----
> From: Ryan vd Merwe [mailto:ryan@8...]
> Sent: Tuesday, November 12, 2002 2:28 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Script being executed twice?
>
>
> Hi
>
> I wrote an application for a client and was working
> fine until a few
> days ago when certain scripts are being run twice or
> even three times
> resulting in multiple duplicate entries in the
> database. The delay
> between the 'reruns' is about 20 seconds. The problem
> is intermittent
> and occurs on different scripts at different times.
>
> My client has a large network that spans different
> locations around the
> country. My client blames me, but I'm sure it is their
> network...in any
> event...has anyone had a similar problem or is there a
> way that I can
> totally prevent my scripts from executing twice.
>
> Thanks
> Ryan
>
>
>
> <a
href="http://mail.canada.com/jump/http://p2p.wrox.com/manager.asp">http://p2p.wrox.com/manager.asp</a> or to
> unsubscribe send a blank email to
>
>
> <a
href="http://mail.canada.com/jump/http://p2p.wrox.com/manager.asp">http://p2p.wrox.com/manager.asp</a> or
>
> <a
href="http://mail.canada.com/jump/http://p2p.wrox.com/manager.asp">http://p2p.wrox.com/manager.asp</a> or
__________________________________________________________
Get your FREE personalized e-mail at http://www.canada.com
Message #6 by "Drew, Ron" <RDrew@B...> on Thu, 14 Nov 2002 14:40:59 -0500
|
|
I agree...you must know what the intent is before scripting. This was
just my response based on what I thought John was looking for. But your
point is while taken.
-----Original Message-----
From: devsql@c... [mailto:devsql@c...]
Sent: Thursday, November 14, 2002 12:22 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Script being executed twice?
Well, I think it depends on the scope of your
application. Sometimes you need to allow user to submit hundreds of
different data on the same window.
I once had an application that allow user to submit
same data. However, I have script in mycode.asp to
check any duplication with the database. If yes,
rollback and display message on new pop up window which
close auto in 3 sec or close by user by clicking close
button. If no, save data in db and close pop up window
auto.
Hope this idea help.
Bill
On Thu, 14 Nov 2002, "Drew, Ron" wrote:
>
> Preventing multiple submits...
>
> <script language=3D'javascript'>
> var submitted=3D0;
> function validateForm()
> {
> if (submitted=3D=3D0)
> {
> document.testForm.submit();
> submitted=3D1;
> }
> }
> </script>
> </head>
> <body>
> <form name=3D'testForm' method=3D'post'
action=3D'mycode.asp'
> onsubmit=3D'return
>
> validateForm()'>
> <input type=3D'text' name=3D'info' size=3D'30'>
> <input type=3D'submit'>
> </form>
>
> -----Original Message-----
> From: John Parlato [mailto:jparlato@m...]
> Sent: Wednesday, November 13, 2002 8:56 PM
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: Script being executed
> twice?
>
>
> If the updates are occuring from web pages, you may
> want to insure that
> the code prevents the update event(submit button) from
> being pressed
> multiple times, without the user even knowing that
> he/she has pressed
> the key multiple times. You must program to prevent
> this. I use two
> procedures. One, I place code in the java script to
> prevent this, and
> then on the server, I use some method of checking for
a
> repeat of the
> same input.
>
> You'll have to look at your own requirements for accomplishing this.
>
>
> -----Original Message-----
> From: Ryan vd Merwe [mailto:ryan@8...]
> Sent: Tuesday, November 12, 2002 2:28 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Script being executed twice?
>
>
> Hi
>
> I wrote an application for a client and was working
> fine until a few
> days ago when certain scripts are being run twice or
> even three times
> resulting in multiple duplicate entries in the
> database. The delay
> between the 'reruns' is about 20 seconds. The problem
> is intermittent
> and occurs on different scripts at different times.
>
> My client has a large network that spans different
> locations around the
> country. My client blames me, but I'm sure it is their network...in
> any event...has anyone had a similar problem or is there a
> way that I can
> totally prevent my scripts from executing twice.
>
> Thanks
> Ryan
>
>
>
> <a
href=3D"http://mail.canada.com/jump/http://p2p.wrox.com/manager.asp">http
:
//p2p.wrox.com/manager.asp</a> or to
> unsubscribe send a blank email to
>
>
> <a
href=3D"http://mail.canada.com/jump/http://p2p.wrox.com/manager.asp">http
:
//p2p.wrox.com/manager.asp</a> or
>
> <a
href=3D"http://mail.canada.com/jump/http://p2p.wrox.com/manager.asp">http
:
//p2p.wrox.com/manager.asp</a> or
__________________________________________________________
Get your FREE personalized e-mail at http://www.canada.com
Message #7 by "khal nayak" <newadeel@l...> on Sat, 16 Nov 2002 12:54:22 +0500
|
|
hello,
Main prob is in ur database and ur databse coding.
u must try 2 assign unique or primary key 2 ur fields in database then u can see thr r no twice insertion in ur DB
OR
if u r using Command Object for insertion then must use Recordset for solving this prob in front end but Also perform step 1 for ur
database for unique values.
clear
--
On Tue, 12 Nov 2002 09:42:02
Craig Flannigan wrote:
>It depends on how you've built your pages.
>
>We did have this problem a long time back, but this was down to our error.
>We placed the Database Insert scripts and Email sending code in one page -
>occasionally, if the mail server wasn't responding quickly enough, or the
>network was congested - users became impatient and usually hit F5 to reload
>the page - trying to speed it up (if only they knew).
>
>This had the problem of running the Database code and email code twice - or
>how ever many times they pressed it. Also - users hitting the Back Button
>can cause problems like this.
>
>We put code in to prevent them going back to the page which did the insert -
>This worked well.
>We also moved the Email code to another page so that only one process was
>occurring on that page. Normally all this code on one page isn't a problem -
>but this email component we used, and inserting into an Access DB wasn't
>quick. By moving it, individual page loads improved, although the
>application wasn't any quicker overall.
>
>Check your code for loops - are you sure all condition-based code is working
>100%? If so - try to install further code to see if the user is re-loading
>the page when it's already posting to a DB.
>
>It may not be anything to do with the users, and could be their network
>causing issues with the server, but I've never heard of it.
>
>
>HTH
>Craig.
>
>-----Original Message-----
>From: Ryan vd Merwe [mailto:ryan@8...]
>Sent: 12 November 2002 07:28
>To: ASP Web HowTo
>Subject: [asp_web_howto] Script being executed twice?
>
>
>Hi
>
>I wrote an application for a client and was working fine until a few days
>ago when certain scripts are being run twice or even three times resulting
>in multiple duplicate entries in the database. The delay between the
>'reruns' is about 20 seconds. The problem is intermittent and occurs on
>different scripts at different times.
>
>My client has a large network that spans different locations around the
>country. My client blames me, but I'm sure it is their network...in any
>event...has anyone had a similar problem or is there a way that I can
>totally prevent my scripts from executing twice.
>
>Thanks
>Ryan
>
>
>
>
>_____________________________________________________________________
>Please contact I.T. Support if you have received this email in error.
>This e-mail has been scanned for all viruses by Star Internet.
>_____________________________________________________________________
>
>
>_____________________________________________________________________
>Kingfield Heath Ltd. Email Disclaimer
>
>Confidentiality : This email and its attachments are intended for the
>above-named only and may be confidential. If they have come to you in
>error you must take no action based on them, nor must you copy or
>show them to anyone; please reply to this email and highlight the
>error.
>
>Security Warning : Please note that this email has been created in
>the knowledge that the internet is not a 100% secure communications
>medium. We advise that you understand and observe this lack of
>security when emailing us.
>
>Viruses : Although we have taken steps to ensure that this email and
>attachments are free from any virus, we advise that, in keeping with
>good computing practice, the recipient should ensure they are
>actually virus free.
>_____________________________________________________________________
>
>
__________________________________________________________
Outgrown your current e-mail service? Get 25MB Storage, POP3 Access,
Advanced Spam protection with LYCOS MAIL PLUS.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
|
|
 |