An alternate approach to that described by Chris is to set redirect="true"
on the error result:

       <event-handler name="signup">
               <broadcasts>
                       <message name="doSignupForm" />
               </broadcasts>
               <results>
                       <result do="page.index" />
                       <result name="error" do="signupform" redirect="true"/>
               </results>
       </event-handler>

Your question triggered a number of thoughts I have on this topic, but
instead of dumping them here I decided instead to post them on my blog:

http://blog.bullamakanka.net/2009/10/model-glue-event-result-handlers.html

I hope you don't mind me using your code as an example.

Cheers,

-- Dennis

On Sat, Oct 10, 2009 at 10:15 PM, Ryan Stille <[email protected]> wrote:

>
> I'm new to model glue.   Having a tough time figuring out how to route
> when there is a success vs error.  For example my "signup" event.  A
> form posts to this, and I validate, and if validation passes I create
> the user and redirect the user somewhere.
>
> If validation fails, I want to redirect the user back to the form.  I
> think I need to use a named result but can't get it working.  My event
> declaration looks like this:
>
>        <event-handler name="signup">
>                <broadcasts>
>                        <message name="doSignupForm" />
>                </broadcasts>
>                <results>
>                        <result do="page.index" />
>                        <result name="error" do="signupform" />
>                </results>
>        </event-handler>
>
> By default, I want the user to go on to the page.index event.  But if
> there was an error, I want to go to signup form.  I think I should
> have it as above and then in my controller if validation failed I
> would use AddResult("error") ?  But it doesn't work.  Seems like the
> user is always redirected to page.index.
>
> Thanks for any help.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
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/model-glue?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to