Validate one form, multiple models, 1.2

2007-07-11 Thread wilson

Hiya,

Could anyone point me in the right direction for a way to validate a
single form based on the rules set in different models?

Basically, my form registers a user (User model) and uploads a photo
(Photo) model.  It's rendered and saved in the users_controller.php so
all fields defined in the User model are validated correctly.  But the
fields from the Photo model aren't validated.

Many thanks!
Wilson


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



Re: Validate one form, multiple models, 1.2

2007-07-11 Thread Ketan Patel

Currently, to validate your User Model you may be doing.

$this-User-data = $this-data;

if ($this-User-validates())
{
}

All you have to do is add the Photo Model.

$uses = array('User','Photo');

$this-User-data = $this-data;
$this-Photo-data = $this-data;

if($this-User-validates()  $this-Photo-validates())
{

}

Above is a crude  simple way to do it and will get you going in right
direction.
Cheers,
Ketan ;-)

wilson wrote:
 Hiya,

 Could anyone point me in the right direction for a way to validate a
 single form based on the rules set in different models?

 Basically, my form registers a user (User model) and uploads a photo
 (Photo) model.  It's rendered and saved in the users_controller.php so
 all fields defined in the User model are validated correctly.  But the
 fields from the Photo model aren't validated.

 Many thanks!
 Wilson


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