inline below

wblakemd said the following on 08/04/2010 01:49 PM:
> Hello All,
>    I think I am getting closer to being able to use m2 effectively,
> however I have some questions about filters and the duration (scope)
> of event.args variable.
>   
I assume you are meaning the Event object when you refer to the
event.args variable. Is that correct?
> Both are pretty simple, but I need some clarification.  It looks to me
> that filters are used for validation and decision making.  Is this
> accurate?  The way I am looking at it is this way:
>
> Form submit event -> form validation filter -> form listener ->
> results page
>   
Yes, they can be used for validation, authentication, decision making,
etc.  However just to throw my 2 cents in. Our validation doesn't take
place at the filter level (it's pushed into our model layer because we
have a validation "framework" that we use).
> Basically you have a form, it gets submitted, it goes to the filter
> for validation and if it passes validation (which would return false,
> thus stopping that event from further processing) it send the data to
> the listener event which does something and after that completes sends
> you to a results or confirmation page (depending on what you are
> trying to do).
>   
Well, sort of correct.  If the filter returns true, the remaining
commands in the event-handler will continue to process.  If it returns
false, the remaining commands after the filter declaration do *not*
process and therefore the event-handler is short-circuited.  At this
point, Mach-II will handle the next event in the queue if there any or
stop processing if there are none.  So if you return false in a filter,
you have to be sure that the filter announces another event into the
event queue or the request will end.
> Well from my understanding, if the filter returns true (basically
> failing the validation) the event can announce another event which
> might be something like message about how you filled out the form
> incorrectly, etc.
>   
Basically yes.  However the remaining commands in the event-handler
won't be processed so the filter would have to announce another event.
> If that is true, is it possible to access the event.args structure and
> return the data to the form so the user does not have to type it all
> back in?  How long does the event.args structure remain in memory?
> Does it remain until you have another event that puts data into the
> event.args structure?
>   
The Event object remains for the entire request so if you announce a new
event (either <announce event="somethingCool" copyEventArgs="true"> or
announceEvent("somethingCool", event.getArgs()) ) you can copy the
current Event args into the next event.  If you do a <redirect>, the
currently processing event will not be there because a redirect does a
cflocation and therefore a new request is being made.  You could use
<redirect ... persist="true"> (a feature of Mach-II) to temporarily
store the event on the redirect so it's copied on the other side of the
redirect into the new request.  Think of this as a "flash" scope that is
temporary (not like session or application scope which persist).

HTH,
Peter

-- 
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to