Thursday, March 31, 2011

1 form 2 models - how to validate without savingAll?

Hi all,

I had been searching for the answer yet I don't find it!

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!)

thanks!

--
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: