A select dropdown will never be empty unless one of the options is an empty string.
- Jon On Nov 1, 2012 5:23 AM, "Chris" <chris...@yahoo.com> wrote: > > hi guys,... I'm using cake 1.3 > how can I validate "select" field from Model,....? > > what I have in bootstrap: > Configure::write('User.genders', array('unknown', 'male', 'female')); > > in a view: > <tr> > <td><strong><?php echo ucfirst(__('gender', true)) ?></strong> > <?php > $genders = array(Configure::read('User.genders')); > echo $this->Form->select('gender', $genders) > ?> > </td> > </tr> > > and in a Model: > var $validate = array( > 'gender' => array( > 'rule' => 'notEmpty', > 'required' => true, > 'message' => 'Gender must be valid', > ), > ); > > I'm not getting warning of red box with "Gender must be valid" > > how can I do this....? > > thanks in advance > chris > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.