I have a user model. In it, I have set validations that are used while registering user. That works fine. But when user edits his profile information, I don't want to validate some fields like password, email, etc. How it is possible. Below is code.
<?php
class User extends AppModel{
var $name = 'User';
// used when user registers
var $validate = array(
'login' => array(
'minLength' => array(
'rule' => array('minLength', '6'),
'field' => 'login',
'message' => 'mimimum 6 characters long'
)
),
'password' => array( // don't want to validate in edit profile page
'minLength' => array(
'rule' => array('minLength', '6'),
'field' => 'password',
'message' => 'minimum 6 characters long'
)
),
'email' => array(
array(
'rule' => 'email',
'message' => 'please enter a valid email address'
)
)
);
?>
Above is used when I register a user. But when user edits his profile, I don't allow to edit/change user password. So each time while editing profile, it checks for password validation. I haven't added password field in edit profile page, I don't want to validate password field. So can I have different validation rules for different actions?
Thanks.