Wednesday, September 29, 2010

Re: Redirection based on validation results.

It sounds like you are saving a record right? When you are done with
your $this->Model->save(), the id of the record will be in $this-
>Model->id and you can redirect from there in the controller.

Why would you want to redirect during validation? Validation is
generally for the saving and updating of records, are you trying to
interrupt that? Or am I misreading your question?

On Sep 29, 11:27 am, Anthony <anthony.c.fra...@gmail.com> wrote:
> Each server has many players and players belong to a server.
>
> Each player may have the same first and last name but only one per
> server.
>
> I have a custom validation that is working correctly when the form is
> submitted.
>
> My thoughts were to kill two birds with one stone and have the
> validation function return 0 for nothing found or the player id if
> found.  Everything works perfectly with this setup for simply
> validating when the form is submitted.
>
> I've seen the handbook on redirecting from the controller based on
> over all success.  However, I want to redirect to the players page if
> a user was found. Is it possible to get the value returned by a
> validation function or will I just have to run the query again?
>
> If that's the case, I should check the validation at the controller,
> read the returned validation results, and check it for my custom rule
> failure?
>
> Is this how I should go about this or is my focus preventing me from
> seeing the bigger picture? Thanks for any assistance and insights.

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: