Dropdown Login box in layout

Hi everyone, Yii noob here.

I made a dropdown login form which is rendered as a partial. It works fine when user credentials are correct and redirects wherever I want to. However if form validation or authentication fails, I can’t get the error messages to be passed to the login form. I think the problem is that my login form is in the main layout (because I want it accessible at any moment) and that the controller can not pass in a clean way variables to the layout.

So here is my login action in SiteController

	public function actionLogin ()


		$form = new LoginForm;

		if (isset($_POST['LoginForm']))



			//validate user input and redirect to user panel if valid

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


				$success = "oui";





				$success = $form->getError('login').$form->getError('password');							


                                //here I can pass the error messages to the index view for example, but not to the login form in the main layout, how can I do this?




Also, in the login form, i set enableAjaxValidation to true, how does that work? Can I say to the controller to respond also via Ajax directly to the form?

One last question : the form should echo $form->errorSummary($model) &model being new LoginForm. Why doesn’t it ever display an error summary?

Thanks for your attention

Bumping just once. If my question is too generic please redirect me to some documentation related to my problem.