Write the Validation Rule in Language Model instead of User Model On Jun 14, 9:56 pm, Shaz <[email protected]> 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
