I ran across this on a tutorial site a few days ago - it's billed as a 
way
to stop this exact problem.  Hopefully this will help - I haven't 
gotten
around to trying it myself yet.

Dirk


--------------------------------
<!--
        FILE FROM WWW.CFTUTORIALS.COM - 
        YOUR USE OF THIS FILE SIGNIFIES YOUR AGREEMENT TO BE BOUND BY THE
TERMS AND CONDITIONS:
        
http://www.cftutorials.com/index.cfm?mode=contentpage&element=terms_
and_cond
itions
-->

<HTML>
<HEAD>
        <TITLE>How to block multiple form submits.</TITLE>
</HEAD>

<BODY>

<FORM ACTION="receive.cfm" METHOD="post">

<FONT SIZE="2">Dummy Form.</FONT><BR><BR>

<INPUT TYPE="Text" NAME="Name"><BR>
<INPUT TYPE="Text"><BR>
<INPUT TYPE="Text"><BR>

<INPUT TYPE="Button" NAME="Submit" VALUE="Submit Form"
onClick="if(this.value == 'Submit Form') this.form.submit(); this.value=
'Please Wait.';">

</FORM>

</BODY>
</HTML>

> -----Original Message-----
> From: Chad Gray [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, January 17, 2002 12:52 PM
> To:   CF-Talk
> Subject:      Re: Strange Inserts into MySQL database
> 
> I have come closer to figuring out how there are two updates running.
> 
> On a SGI Irix box running Netscape the user can double click the 
submit 
> button on the form.  I looked in the web log files and saw this:
> 
> 127.0.0.1, -, 1/16/02, 20:14:03, W3SVC, SERVER, 127.0.0.1, 172, 513, 
504, 
> 200, 0, POST, /employee/JOBLOGIN.CFM, -,
> 127.0.0.1, -, 1/16/02, 20:14:03, W3SVC, SERVER, 127.0.0.1, 203, 513, 
504, 
> 200, 0, POST, /employee/JOBLOGIN.CFM, -,
> 
> Is there any way to keep people from double clicking on the submit 
button 
> and getting two POSTs?
> 
> 
> 
> At 07:39 PM 1/16/2002 -0500, you wrote:
> >I am getting strange inserts every once and while.  Not all the 
time, it
> >has only happened 3 times in the last 4 months.  What is happening 
is
> >somehow people are getting two (one time a person got 40+) inserts 
into
> the
> >table when they should only get one insert.  Tonight i added a 
<CFLOCK>
> >around the entire process, but im not sure if that will help.
> >
> >Why, or how could the insert run more then once?
> >Is there a better way to write the following code?
> >
> >
> ><!--- check to see if the user is in the table --->
> ><cfquery name="employeejobcheck" DATASOURCE="#dsn#" 
dbtype="ODBC">
> >SELECT JOBNUM, EMPLOYEENUM, LOGOUT, LOGIN
> >FROM ACTIVITYLOG
> >WHERE (JOBNUM = #FORM.JOBNUM#) AND (EMPLOYEENUM = 
#FORM.EMPLOYEENUM#) 
>  AND
> >(LOGOUT is null) AND (LOGIN is not null)
> ></cfquery>
> >
> ><!--- if the user is not in the table insert them --->
> ><cfif employeejobcheck.recordcount eq 0>
> >
> ><cfquery DATASOURCE="#dsn#">
> >INSERT INTO ACTIVITYLOG(
> 
>ACTIVITYDESCRIPTION,ACTIVITYID,COSTPERHOUR,JOBNUM,EMPLOYEENUM,EMPLOYEEN
AM
> E,
> LOGIN)
> >VALUES
> 
>('#ACTIVITYLOOKUP.ACTIVITYDESCRIPTION#','#ACTIVITYLOOKUP.ACTIVITYID#',#
AC
> TI
> 
VITYLOOKUP.COSTPERHOUR#,#FORM.JOBNUM#,#FORM.EMPLOYEENUM#,'#FORM.EMPLOYEE
NA
> ME
> #',#NOW()#)
> ></cfquery>
> >
> ></cfif>
> >
> >
> >Thanks,
> >Chad
> >
> >
> 

______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to