[thelist] cf redirection
isaac forman
isaac at members.evolt.org
Mon Jul 17 11:51:16 CDT 2000
Aaron,
> i have a simple cf admin page using cfswitch (thanks to palyne's tip a few
> weeks ago) with four cases. most of the cases do a very specific db action
> (e.g., delete a record, update a record, etc) - and all I want to do is
> flash a message saying "record updated" then redirect back to the main page.
Why not write the message into the main page?
I adopted a technique used by jeff (and walker I think): session.pageresponse.
I'm sure it's used by a tonne of other people too. Actually, the pageresponse I
learnt from walker's original evolt.org code which used alot of cfincludes. But
due to the incompatability of cfinclude with setting cookies in some situations,
I shifted to using cflocation, which necessitated holding the pageresponse from
page to page - ie, using a session variable.
On every page, I have a placeholder for the response which looks something like
this (I usually put it in the header file I'm using, just above the content, and
colour it red to get attention):
<cfif len(session.pageresponse)>
<cfoutput><p class=response>#session.pageresponse#</p></cfoutput>
<cfset session.pageresponse = "">
</cfif>
In my Application.cfm:
<cfparam name="session.pageresponse" default="">
And then to write to the pageresponse, eg, after a record has been deleted, or a
user has successfully registered, I'll use:
<cfset session.pageresponse = "Thanks for registering!">
<cflocation url = "index.cfm?#vars#">
By this method, the pageresponse is ready and waiting for whatever messages you
need to throw at the user - alerting them to required form fields, letting them
know that tasks have been completed successfully, or giving them specific
information in a step-by-step procedure.
I apologise if this is not the type of solution you were looking for, and you're
set on the timed-refresh.
isaac
More information about the thelist
mailing list