announceEvent overwritten by redirect

4 views
Skip to first unread message

Matthew

unread,
Dec 3, 2009, 5:18:26 PM12/3/09
to Mach-II for CFML
Hi guys

I have an if statement in my listener which throws and announceEvent
if a validation error occurs. It works fine but when I add a <redirect
event.../> into my config xml the announceEvent appears to be skipped
and everything is redirected. My logic is if an error occurs throw and
announceEvent but if all passes then the redirect kicks in. I'm
guessing the redirect takes precedence? I don't really want to have
another announceEvent for success/pass scenarios so what else can I
do?

Cheers
Matthew

Peter J. Farrell

unread,
Dec 3, 2009, 5:50:46 PM12/3/09
to Mach-II for CFML
This is expected behavior since <redirect> is a specialized form of
the your CFML's engine <cflocation> tag:

http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/ConfigFileExplained#Warning-ImmediateEndingofRequests

.pjf

Matthew

unread,
Dec 3, 2009, 6:04:40 PM12/3/09
to Mach-II for CFML
Ok, thanks Peter. So I'm guessing that most people have an if with an
else statement in their listener where one catches errors (and re-
shows the form with error messages) where as the other shows the
success page. My only issue with having an announceEvent on success is
if the user refreshes the page it will re-run all the save logic and
create duplicate records where as after a redirect a refresh would
just refresh the success page.

On Dec 4, 9:50 am, "Peter J. Farrell" <pe...@mach-ii.com> wrote:
> This is expected behavior since <redirect> is a specialized form of
> the your CFML's engine <cflocation> tag:
>
> http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/ConfigFileExpla...

Peter J. Farrell

unread,
Dec 3, 2009, 6:52:28 PM12/3/09
to mach-ii-for...@googlegroups.com
the way to solve your problem is to always do a prg (post redirct get) routine. It's really the nature of how browsers and http work and the burden of developing web applications.
--
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to mach-ii-for...@googlegroups.com
To unsubscribe from this group, send email to mach-ii-for-coldf...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets: http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/

Matthew

unread,
Dec 3, 2009, 8:22:56 PM12/3/09
to Mach-II for CFML
Hi Peter

I saw PRG mentioned in another thread recently so I'll have a search
for it and I'll look on Google as well, but if by chance have a link
to a useful reference that would be great.

Cheers
Matthew
> For more options, visit this group athttp://groups.google.com/group/mach-ii-for-coldfusion?hl=en
Reply all
Reply to author
Forward
0 new messages