Chtml::errorsummary($Model); Not Working!

Ok

So I am trying to submit a simple form

Form Model :

public function rules()

{


	return array(





		array('email', 'required'),


		array('email','email'),








		);


}

View File

<?php $form=$this->beginWidget(‘CActiveForm’, array(

				        'id'=&gt;'login-form',


				        'enableClientValidation'=&gt;true, // enabled


				        'clientOptions'=&gt;array(


				                'validateOnSubmit'=&gt;true,


				        ),


				)); ?&gt;


				&lt;?php echo CHtml::errorSummary(&#036;model); ?&gt;

<?php echo CHtml::activeLabelEx($model,‘email’)?>

                        &lt;?php echo CHtml::activeTextfield(&#036;model,'email')?&gt;

<?php echo CHtml::submitButton(‘Submit’); ?>

						&lt;/div&gt;


		    		


		    	&lt;/fieldset&gt;


		    	&lt;?php &#036;this-&gt;endWidget(); ?&gt;

[b]Controller Action

[/b]

$model=new ForgotEmailForm;

		&#036;this-&gt;render('forgotpassword',array('model'=&gt;&#036;model));


		//echo &quot;You are in Forgot PAssword&quot;;


		


		if(isset(&#036;_POST['ForgotEmailForm'])) { 


										





										&#036;model-&gt;email=&#036;_POST['ForgotEmailForm']['email'];


										if(&#036;model-&gt;validate())

The problem is , when I push submit button. It doesnot show anything in the CHtml::errorSummary($model);

In your controller, you have


$this->render

happening before anything gets a chance to be checked. The render method is basically halting your application right at that point no matter what.

Edit: Try something like this. It will do post processing and then render afterwards


$model = new ForgotEmailForm;

if($data = Yii::app()->request->getPost('ForgotEmailForm')) {

    $model->attributes = $data;

    if($model->validate()) {

        $model->save();

    }

}

$this->render('forgotpassword', array('model' => $model));

Thanks this helped!! Cheers :)