I can - but in that arises another situation: I also have Location HABT Language - and I don't want any restrictions there. So a location can have more than 3 or no languages associated with it.
So if place the above $validate in language model, both users and locations will need to pass that validation; where I only want the users to... Thanks! On Jun 14, 8:14 pm, hunny <saurabh85maha...@gmail.com> wrote: > Write the Validation Rule in Language Model instead of User Model > > On Jun 14, 9:56 pm, Shaz <shazam...@gmail.com> wrote: > > > > > > > > > I have User HABTM Language, and i want to ensure during a User add / > > edit they choose a minimum of one language, upto a maximum of 3. In > > the user model, for $validate I've tried: > > > 'Language' => array( > > 'multiple' => array( > > 'rule' => array('multiple', array('min' => > > 1, 'max' => 3)), > > 'message' => 'Please select a tleast 1 > > langiage upto a maximum of > > 3' > > ), > > ), > > > And in the add/edit form i have $this->Form->input('Language'); which > > doesn't actually validate. > > > It does work if I use language_id instead of Language (both in the > > form on the add/edit pages and in the model $validate) - but then it > > doesn't save any data in the join table. > > > Any advice on getting the above to validate, or save habtm when using > > "_id". -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php