Thanks for the reply.
In users_controller, I added this line
$this->User->changeValidation('email');
if(!empty($this->data)) {
if($this->User->validates())
{
$this->data['User']['id'] = $this->Auth->user('id');
$this->User->create();
if ($this->User->save($this->data)) {
}
}
}
There is something like this
and in user model
function changeValidation($type)
{
if($type == 'email') {
$this->validate = array (
'email' => array(
'notEmpty' => array(
'rule' => 'email',
'required' => true,
'allowEmpty' => false,
'message' => 'Please enter a valid email.. ( New
Validation Rule )'
),
'unique' => array(
'rule' => array('checkUnique', 'email'),
'message' => 'Email exist. Use another'
)
)
);
}
}
I typed the right email address. But I got
'Please enter a valid email.. ( New Validation Rule ) error. Am i doing
anything wrong?
@Jeremy Burns : User model is used during registration and edit. In general,
when user signup, model should not allow empty fields. and during edit, they
are given two different forms. One just to edit the password and another one
is just to edit the email address. So, I have to change the validation array
according to the forms.
--
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