Cake 1.2.6 Can anyone explain how this is supposed to work? As is too often the case, the cookbook example is very unclear. For one thing, how does one specify which field this rule applies to?
This is what I have now (the 'ElectionOffice' rule): class Election extends AppModel { var $hasMany = array('ElectionBallot'); var $hasAndBelongsToMany = array('ElectionOffice'); var $validate = array( 'deadline' => array( 'rule' => 'date', 'required' => true, 'allowEmpty' => false, 'message' => 'You must declare a deadline date.' ), 'ElectionOffice' => array( 'rule' => array('multiple', array('min' => 1)), 'required' => true, 'message' => 'Please select at least one Office' ) ); } ElectionsController: public function admin_add() { if (!empty($this->data)) { $this->Election->set($this->data); if ($this->Election->save()) { $this->flash( 'Election created', array('action' => 'index') ); } } $offices = $this->ElectionOffice->find('list'); $this->set(compact('offices')); } form: <?= $form->select( 'ElectionOffice.id', $offices, null, array('multiple' => 'checkbox', 'checked' => true) ) ?> PS: 'checked' => true isn't working either. 'selected' didn't work and I found a comment online saying to use 'checked'. What's the proper param? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en