Hi Joe,
Thanks for the reply, this has been driving me a bit crazy :)
I've had a look at EventContext.cfc and i think the issue is with the
addResult() method, and the way it handles results with redirect=true.
The addResult method loops over the eventhandler results for every
format, not just the current requestFormat. So when it finds one that
matches, that has redirect=true it will immediately redirect to the
new event preventing the result for the current requestFormat from
ever being reached.
I've modified my EventContent.addResult() to look like this
<cffunction name="addResult" access="public" hint="Adds a result, by
name, to the result queue.">
<cfargument name="resultName" type="string" hint="The name of the
result (e.g., ""formInvalid"" or the like) to add." />
<cfset var results = getResults() />
<cfset var format = "" />
<cfset var formatList = listappend(getValue("requestFormat", ""),
"cfNullKeyWorkaround") />
<cfset var i = "" />
<cfset var eh = getCurrentEventHandler() />
<cfset var result = "" />
<cfset trace("Message Listener", "A named result
""#arguments.resultName#"" has been added.") />
<cfloop list="#formatList#" index="format">
<cfif structkeyexists(eh.results, format) AND
structKeyExists(eh.results[format], arguments.resultName)>
<cfloop from="1" to="#arrayLen(eh.results[format]
[arguments.resultName])#" index="i">
<cfset result = eh.results[format][arguments.resultName][i] />
<cfif result.redirect>
<cfset this.trace("Result", "Explicit result redirecting to event
""#result.event#""", "<result do=""#result.event#"" redirect=""true"" /
>") />
<cfset forward(eventName:result.event,
preserveState:result.preserveState, addToken:false,
append:result.append, anchor:result.anchor) />
</cfif>
</cfloop>
</cfif>
</cfloop>
<cfset arrayAppend(variables._results, arguments.resultName) />
</cffunction>
I've replaced the outer loop over all formats with a loop over the
current requestFormat, and "cfNullKeyWorkaround" only (which i believe
is for results with no format specified). This seems reasonable to
me, as I can't think why you would want alternate request format
results being fired on the current request.
Hopefully that makes some sense, but feel free to point out the
obvious gotchas that i've missed :)
Cheers, Chris
On Jul 29, 2:26 pm, Joe Rinehart <
j...@firemoss.com> wrote:
> This may be a bug in format-specific result handling, I'll look into
> it when I can. If you'd like to help me verify, feel free to open up
> EventContext.cfc, jump down to the part where it's handling results,
> and if you could look into what's going on when it dequeues results
> it'd be handy - feel free to file any findings athttp://
bugs.model-glue.com/jira