I have an "add" function that isn't being validated using the form
helper, even though I have the model set to validate. It just inserts
the record and I can't figure out why since I haven't had this problem
before.
Snippet from controller:
function add() {
$user = $this->Auth->user();
$user_id = $user['User']['id'];
if(!empty($this->data)) {
$this->data['Birthday']['user_id'] = $user_id;
$this->Birthday->create();
if($this->Birthday->save($this->data)) {
$this->Session->setFlash('Birthday was
added');
$this->redirect('/birthdays/add');
}
}
}
Snippet from model:
var $belongsTo = 'User';
var $validates = array(
'first_name' => array(
'minlength' => array(
'allowEmpty' => false,
'rule' => array('minLength', 1),
'message' => 'First name cannot be
empty'
)
),
Any idea why this isn't validating?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---