This email is to be read subject to the disclaimer below.
Hi Mark,
Are you trying to prevent people from performing the same action twice from
the same form? Or are you only trying to prevent them doing it
*accidentally*?
ie. are you trying to stop them hitting "Back" and re-submitting the form
to deliberately perform the same action (eg: add new user) twice, or only
if the reply from the server get's delayed?
Gary's UUID method works well if you don't ever want people going back and
re-submitting the form. If you only try to prevent the double-click
problem, you could do something like this:
1.) Set an UUID on the form.
2.) Check if the action has already been performed (perhaps within the last
minute?) or if it's ok to perform the action again.
3.) Surround the above code with a <cflock name="#Form.UUID#" type
="exclusive"> to guard against race conditions
4.) if the check in 2.) failed, do not perform the action again.
This way you can guarantee that even if the two pieces of code will run at
the same time they will not get into each other's way.
Cheers,
Vik
---------------------
Viktor Radnai
Web Developer, National E-Commerce, Ernst & Young
Direct: +61 2 9248 4361
"Mark Stanton"
<[EMAIL PROTECTED]> To: "CFAussie Mailing
List" <[EMAIL PROTECTED]>
Sent by: cc:
[EMAIL PROTECTED] Subject: [cfaussie] RE: stopping the
double click effect
mon.com.au
27/03/2003 01:09 PM
Please respond to "CFAussie
Mailing List"
Barry & Andrew:
I am aware that you can do it with javascript but it doesn't really help in
a situation where the client has javascript turned off. I'm really looking
for something server side.
Gary:
Looks interesting - will give it some thought. By suggesting this are you
saying I can't use cflock in this situation.
cflock type="exclusive"
query to check if record already exists
if not
do some things
do some more things
do lots more things
write record
/cflock
Before I posted the last mail I had only gone over the help files in the mx
update for homesite (which are a step backwards in many cases). I've just
been checking livedocs and it says:
"An exclusive lock single-threads access to the CFML constructs in its
body.
Single-threaded access implies that the body of the tag can be executed by
at most one request at a time."
I guess what I need to know is does this just mean access to variables (as
specified in the scope attribute) in the body of the tag or does it mean
anything (queries, etc..) in the tag body?
Cheers
Mark
______________
Mark Stanton
Web Production
Gruden Pty Ltd
Tel: 9956 6388
Mob: 0410 458 201
Fax: 9956 8433
www.gruden.com
---
You are currently subscribed to cfaussie as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/
--------------------
NOTICE - This communication contains information which is confidential and
the copyright of Ernst & Young or a third party.
If you are not the intended recipient of this communication please delete
and destroy all copies and telephone Ernst & Young on 1800 655 717
immediately. If you are the intended recipient of this communication you
should not copy, disclose or distribute this communication without the
authority of Ernst & Young.
Any views expressed in this Communication are those of the individual
sender, except where the sender specifically states them to be the views of
Ernst & Young.
Except as required at law, Ernst & Young does not represent, warrant and/or
guarantee that the integrity of this communication has been maintained nor
that the communication is free of errors, virus, interception or
interference.
Liability limited by the Accountants Scheme, approved under the
Professional Standards Act 1994 (NSW)
--------------------
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/