Friday, April 1, 2011

Re: 1 form 2 models - how to validate without savingAll?

On Mar 31, 2011, at 19:10, netusco wrote:

> I'm having a 3 steps form so I'm not saving the data in each step, only validating it and passing it hidden in each step.
>
> In the form I use 2 different models.
>
> So if I try to validate like this:
> $this->User->set($this->data);
> $this->User->Profile->set($this->data);
> if ($this->User->validates() && $this->User->Profile->validates()) { ...
>
> I'm only getting the User data validated. If I comment the first line the one that sets the data for User model then I get the Profile data validated.
>
> So How can I get them both at the same time??? (without using saveAll!)

For a multi-page form, consider using the Wizard component, or reading its code to see how it does it.

https://github.com/jaredhoyt/cakephp-wizard


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: