I've used the same technique, but I'd like to add one thing...

I've had administrative pages that I wanted to refresh to the same
page, only with the fields in the form populated. So I've used
cflocation to the same page with the appropriate URL variable
populated. That way, even if they refresh the form, the POST has been
broken and the page just refreshes with the same data.

It works nicely.

Laterz,
J


On Wed, 9 Feb 2005 09:58:51 -0800, Bryan Stevenson
<[EMAIL PROTECTED]> wrote:
> There are MANY ways to deal with this...so I'd search the archives or this
> thread will spin out of control ;-)
> 
> Personally this is what I do:
> 
> 1) form submits to itself (naming form button "Task"...so when the form
> posts to itself you can check at the top of your file if FORM.Task
> IsDefined()....if defined.see step 2)
> 2) if submitted, the insert query runs (after form data is validated of
> course)
> 3) user is sent to a confirmation page via CFLOCATION
> 
> So now if they refresh the page it's just the confirmation and not the form
> page which would re-insert the data as you're seeing now.
> 
> HTH
> 
> Cheers
> 
> Bryan Stevenson B.Comm.
> VP & Director of E-Commerce Development
> Electric Edge Systems Group Inc.
> phone: 250.480.0642
> fax: 250.480.1264
> cell: 250.920.8830
> e-mail: [EMAIL PROTECTED]
> web: www.electricedgesystems.com
> ----- Original Message -----
> From: "Discover Antartica" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[email protected]>
> Sent: Wednesday, February 09, 2005 9:48 AM
> Subject: Refreshing the page gives problems
> 
> > The form in the page is submitting to the same page. If the user refreshes
> > the page, then, the query to insert the record filled out in the form is
> > executed again. So, the number of records in the table keep increasing.
> >
> > is there a way to prevent this?
> >
> > The primary key in the table the data is being inserted is a counter that
> > increments itself. It is not part of the query that is inserting the new
> > records.
> >
> > merci!
> >
> >
> >
> >
> >
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193919
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to