Couldn't you write a custom validation rule in the Post model that examines the 
count of the Category key of the data array passed in?

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 1 Apr 2011, at 01:18, Krissy Masters wrote:

> How can you validate the number of "multiple" selected?
> 
> I have a Post which hasMany, and HABTM relations so saving with :
> 
> if ( $this->Post->saveAll( $this->data, array('validate' => 'only') ) )
> {//only testing to get errors
> 
> but I never get any validation errors for the HABTM model
> 
> Category:
> public $validate = array(
>       
>               'Category' => array(
>                       'multiple' => array(
>                               'required' => false,
>                               'allowEmpty' => true,
>                               'rule' => array(
>                                       'multiple', array('max' => 3),
>                               'message' => 'Please select one, two or
> three options'))));
> 
> 
> Post HABTM Category
> 
> Ideas?
> 
> Thanks
> 
> K
> 
> -- 
> 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
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to