Validate Form Unique Field

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,username','unique', 'className'=>'User', 'caseSensitive' => 'false')



My problem is that i can’t make the uniqueness work.

Could you please try to edit this line like this.


and please tell me what you get.

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.’),