> $this->User->validates($this->data); // always return true > $this->User->save($this->data); // always return true, and try to save
You say it always returns true, but are you testing that in an if block? On Wed, Apr 8, 2009 at 9:59 AM, Rhee <[email protected]> wrote: > > Hi, > > the data validation in my User Model always return true. Can anybody > tell me why? > > In Model: > > var $validate = array ( > 'login' => array ( > 'notempty' => array ( > 'rule' => array('custom', > VALID_NOT_EMPTY), > 'message' => 'Error' > ), > 'unique' => array ( > 'rule' => 'isUnique', > 'message' => 'Error' > ), > 'minlength' => array ( > 'rule' => array ('minLength', '5'), > 'message' => 'Error' > ), > 'alphanumeric' => array ( > 'rule' => 'alphaNumeric', > 'message' => 'Error > ) > ), > 'passwd' => array ( > 'minlength' => array ( > 'rule' => array ('minLength', '8'), > 'message' => 'Error' > ) > ), > 'title' => array ( > 'rule' => array ('inList', array ('Mr.', > 'Mrs.')), > 'message' => 'Error' > ), > 'forename' => array ( > 'rule' => array('custom', VALID_NOT_EMPTY), > 'message' => 'Error' > ), > 'name' => array ( > 'rule' => array('custom', VALID_NOT_EMPTY), > 'message' => 'Error' > ), > 'email' => array ( > 'rule' => array ('email', true), > 'message' => 'Error' > ) > ); > > In Controller: > > $this->User->validates($this->data); // always return true > $this->User->save($this->data); // always return true, and try to save > the data, which is of course error, due to NOT NULL constrains in > database. > > Thanks for the help. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
