Tuesday, November 30, 2010

Form validation and routes - errors lead to controller/action instead of route!

Hey,


the problem I have came up very often the last weeks but I couldn't
find a solution yet. Maybe one of you has a clue how to do this.

The facts:

in my users_controller i have an action called "register", which is
mapped to the route http:://www.domain.com/register

This is working, and very easy to set up. But when I now make any
mistake in the form given in the register action, the url in the
browser switches back to users/register, which is the correct action,
but not the correct route!

I could do a redirect when an error occurs, but the form validation
errors (by model validation OR invalidate()) are gone when a redirect
is done.

There has to be a solution for this, I just do not want to store all
errors in the Session and add the errors manually into the form and
delete them afterwards from the Session.

Does anyone have any idea how to solve this little problem?

Regards,

DD

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: