Your code should read as follows:
CFIF IsDefined(session.ranAlready)
and dont forget to lock your session scope..
Paul
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
cfif not (structKeyExists(session, ranAlready) and
session.ranAlready)
Run Code
cfset session.ranAlready = true
/cfif
This will mean the code will only be ran once per session *not*
refresh is that what you are trying to achieve?
Probs want to lock it as well
--
dc
[Todays
need to reverse you Boolean logic
cfif NOT IsDefined(session.ranalready)
Do Stuff
cfelse
Don't do stuff
/cfif
Confidentiality Notice:This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized
:[EMAIL PROTECTED]
Sent: Friday, June 04, 2004 10:16 AM
To: CF-Talk
Subject: RE: prevent refresh w/session
cfif not (structKeyExists(session, ranAlready) and
session.ranAlready)
Run Code
cfset session.ranAlready = true
/cfif
This will mean the code will only be ran once per session
Yes. Except when I use the not after the CFIF it doesn't
display the page at all. When I leave the not in it
displays it, but when I refresh it adds data to the page and
that's what I'm trying to avoid. Am I still missing something?
I would recommend using cfparam then check for a value
-Original Message-
From: Katz, Dov B (IT) [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 February 2004 6:43 AM
To: CF-Talk
Subject: RE: Prevent Refresh
I think you need to take a 2 part strategy
1) set up some onClick so the form button disables itself upon
submission. That way
Try cflocation after all code has executed...
Taco Fleur
Bloghttp://www.tacofleur.com/index/blog/
http://www.tacofleur.com/index/blog/
Methodology http://www.tacofleur.com/index/methodology/
Tell me and I will forget
Show me and I will remember
Teach me and I will learn
-Original
You could wrap your code around a CFIF statement that checks to see if the
cgi.http_referer does not equal or the current page. Then it would run
the refresh but not the email code.
-Original Message-
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 11, 2004 1:31
they like
Clicking back, will never get the interim form-submitted page, so you
should be safe.
-Dov
_
From: Ryan Kime [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 11, 2004 3:33 PM
To: CF-Talk
Subject: RE: Prevent Refresh
You could wrap your code around a CFIF statement
will forget
Show me and I will remember
Teach me and I will learn
-Original Message-
From: Katz, Dov B (IT) [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 February 2004 6:43 AM
To: CF-Talk
Subject: RE: Prevent Refresh
I think you need to take a 2 part strategy
1) set up some onClick so
input type=button
>
This will still submit the form.
-nathan strutz
-Original Message-
From: Taco Fleur [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 11, 2004 2:13 PM
To: CF-Talk
Subject: RE: Prevent Refresh
1) I think you mean hide the button, as soon as you disable the sub
: Wednesday, February 11, 2004 4:13 PM
To: CF-Talk
Subject: RE: Prevent Refresh
1) I think you mean hide the button, as soon as you disable the
submit
button it will not submit the form, even if you just clicked it.
Taco Fleur
Bloghttp://www.tacofleur.com/index/blog/
http
/blog/
Methodology http://www.tacofleur.com/index/methodology/
Tell me and I will forget
Show me and I will remember
Teach me and I will learn
-Original Message-
From: Nathan Strutz [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 February 2004 7:20 AM
To: CF-Talk
Subject: RE: Prevent Refresh
Great job! That works fine.
Thanks
-Original Message-
From: Matt Robertson [mailto:[EMAIL PROTECTED]
Sent: 10 June 2003 22:00
To: CF-Talk
Subject: Re: Prevent Refresh
Isaac wrote:
You could do that -- you'd have to use javascript to submit
the form and set the value of the field
What I do is the following:
1) Set a session variable on the page that will submit the form, usually
called session.frm_submit, and set it to 1.
2) Create a CFIF on the page the form submits to that checks the value of
the session variable, and, if it is 1, sets it to 0 then processes the
To avoid the refresh problem the best way to handle idempotent actions
i.e form submissions is to perform a redirection after the relevant
action has occurred.
Note: This requires a client-side redirect which cflocation will do
for you. So the page flow becomes this:
1) Form
2) Action Page -
oi Shahzad.Butt!!
on the preceding page...
script
window.history.forward();
/script
this will prevent use of the back button...
on your form page.. for the refresh problem you can do this...
if not isDefined(request.pageHit)
... do page stuff.
set request.pageHit = true
cfelse
Something else you can do is disable the submit button onClick
input type=submit name=submit value=submit
onClick=this.disabled=true;
I think thats the right value to assign to disabled.
Stephen
- Original Message -
From: Shahzad.Butt [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
oi Critz!!
whoops.. request scope won't work doh! session will..
Tuesday, June 10, 2003, 9:32:55 AM, you wrote:
C oi Shahzad.Butt!!
C on the preceding page...
C script
C window.history.forward();
C /script
C this will prevent use of the back
I cant use session scope in my app because of load balancing and stuff.
So need a work around using request scope. Any suggetions???
Shaz
-Original Message-
From: Critz [mailto:[EMAIL PROTECTED]
Sent: 10 June 2003 14:48
To: CF-Talk
Subject: Re: Prevent Refresh
oi Critz!!
whoops
-
SB From: Critz [mailto:[EMAIL PROTECTED]
SB Sent: 10 June 2003 14:48
SB To: CF-Talk
SB Subject: Re: Prevent Refresh
SB oi Critz!!
SB whoops.. request scope won't work doh! session will..
SB
SB Tuesday, June 10, 2003, 9:32:55 AM, you wrote:
C oi
What is best way of preventing multiple entries in DB
through form
submission when user clicks on REFRESH or BACK button of
browser?
Thanks
Shaz
I usually use cflocation to move the browser to a confirmation template which informs
the user that the record has been updated.
In my case,
Aren't there issues with disabled in some fairly common versions of NS and Mozilla?
Something else you can do is disable the submit button
onClick
input type=submit name=submit value=submit
onClick=this.disabled=true;
I think thats the right value to assign to disabled.
Stephen
-
successfully runs, I do a cflocation to a Thank You page. This
way, a refresh only refreshes that page.
- Original Message -
From: S. Isaac Dealey [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 12:34 PM
Subject: Re: Prevent Refresh
What is best way
PROTECTED]
Sent: Tuesday, June 10, 2003 12:34 PM
Subject: Re: Prevent Refresh
What is best way of preventing multiple entries in DB
through form
submission when user clicks on REFRESH or BACK button
of
browser?
Thanks
Shaz
I usually use cflocation to move the browser
-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 12:34 PM
Subject: Re: Prevent Refresh
What is best way of preventing multiple entries in DB
through form
submission when user clicks on REFRESH or BACK button of
browser?
Thanks
Shaz
I usually use cflocation to move the browser
squat about cf
- Original Message -
From: Charlie Griefer [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 3:42 PM
Subject: Re: Prevent Refresh
I agree with just about everything Isaac said, but wanted to chime in and
say that the easiest solution would
Subject: Re: Prevent Refresh
I agree with just about everything Isaac said, but wanted
to chime in and
say that the easiest solution would be the cflocation
on the form's
action
page. This is generally how I prevent the duplicate
submissions.
The form's action page contains no HTML, just
: Re: Prevent Refresh
can always add a hidden field to the form with a specified value
and then on the processing page add something like:
!--- check for duplicate form submissions ---
cfif #form.submissionCheck# EQ submitted
Geezo have some patients, you already submitted the form!
/cfif
Message -
From: Charlie Griefer [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 4:24 PM
Subject: Re: Prevent Refresh
wouldn't that fire every time the form was submitted?
and if refresh was pressed on the form's action page...how would it
prevent
the data from re
:04 PM
Subject: Re: Prevent Refresh
can always add a hidden field to the form with a
specified value
and then on the processing page add something like:
!--- check for duplicate form submissions ---
cfif #form.submissionCheck# EQ submitted
Geezo have some patients, you already submitted
Message -
From: Charlie Griefer [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 3:42 PM
Subject: Re: Prevent Refresh
I agree with just about everything Isaac said, but wanted
to chime in and
say that the easiest solution would be the cflocation
on the form's
Isaac wrote:
You could do that -- you'd have to use javascript to
submit
the form and set the value of the field after the form is
submitted.
Nope. I use something very close to the code below. The
user is assigned a form ID on arrival. This ID is checked
for using both the persistent var
Well, I was commenting on having passed a variable from a form
and simply determining whether to perform the action or
display the message on the basis of just that one form field,
without any other context such as the db, etc.
ah... I missed that boat.
Gotta love fire-and-forget solutions.
34 matches
Mail list logo