You're 99% of the way there. you just need to add a "success" result in your
controller if the signup is ok. then make page.index a named result.I would
say its always best to check for a success condition and fallback to a
failure, rather than the opposite.
<event-handler name="signup">
<broadcasts>
<message name="doSignupForm" />
</broadcasts>
<results>
<result name="success" do="page.index" />
<result name="error" do="signupform" />
</results>
</event-handler>
2009/10/11 Ryan Stille <[email protected]>
>
> 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
-~----------~----~----~----~------~----~------~--~---