on Submit Login form, it doesn't show errors

i am new to yii… this is my first form…

i have created a simple login form using user model (user table)…

which validates the user name and password from database and direct user to its own page… (ex: if admin, to admin’s page) like wise.

the problem is, on submitting the form with keeping blanks (for both user and pass field) it display error messages

as defined in USER model class… for example… i have defined as, username and password is required…

array(‘user_name, user_pass’, ‘required’, ‘on’=>‘loginn’)

so those errors are being displayed if the form is empty submitted.

but when wrong values are given, it validates properly… but doesn’t show any error message as username or password entered is not correct or not found.

but, when i use set flash message as error or notice… its displayed… (this way i dont want it to be )

below given is my login action… please let me know what i made as mistake.

if(isset($_POST[‘Users’]))

	{


		$model->attributes=$_POST['Users'];


		if($model->validate() && $model->login())


		{


                        //if($this->validateUser($_POST['Users']['user_name'],$_POST['Users']['user_pass'])){


                            


                            $this->redirect('test');





                    }


                    


                    else {


                           Yii::app()->user->setFlash('error', "username or password is incorrect");


                        }


                    


             }

simply use $model->save(); it validates it…

Hi.

The login form is not linked directly to the User model.

A form linked to the user model would be for viewing, creating, updating, or deleting a user.

The standard webapp created by yiic already has a standard login form. You’ll find easily on the user guide, Larry Ullman’s series, and the forum how to link it to the database.

Cheers

thanks rajith…

i simply added the following line into function rules.

array(‘user_pass’, ‘authenticate’, ‘on’=>‘loginn’),

now its solved.

thanks a lot :)