johniem
(Jm Moonlight)
1
I have create a module for user registration.
I have the controllers/RegisterController
and the models/RegisterFrom extends CFormModel for validation.
here is the rules function
public function rules()
{
return array(
array('username, password, password_confirm, email, name, lastname','required'),
array('password_confirm', 'compare', 'compareAttribute'=>'password'),
array('username', 'length', 'min'=>3, 'max'=>12),
array('email','email'),
array('email,username','unique', 'className'=>'User', 'caseSensitive' => 'false')
);
}
My problem is that i can’t make the uniqueness work.
jayant
(Codesutras)
2
Could you please try to edit this line like this.
array('email,username','unique'),
and please tell me what you get.
sukunj
(Mendparasukunj27)
3
Remove class name and case sensative attribute and define it as another rule and try using following:
array(‘email,username’, ‘unique’ ,‘message’=>‘Email ID must be unique.’),