how to show the custom error msg with validation failed msg

Hi there, I would like to show my custom error msg with rule validation fail error msg. How can I do it?

this set msg from controller


$expire_date_error = '<p>Please enter the company license expire date more than notification days</p>

					<ul>

					<li>Expire Date is less than notificaion days on current date.</li>

					</ul>';

				Yii::app()->user->setFlash('expire_date_error',$expire_date_error);	


		$this->render('create',array(

			'model'=>$model,

this get msg from view.


<?php if(Yii::app()->user->hasFlash('expire_date_error')):?>

        <div class="errorMessage">

            <?php echo Yii::app()->user->getFlash('expire_date_error'); ?>

        </div>

    <?php endif; ?>

I used some code from http://www.yiiframework.com/wiki/21/how-to-work-with-flash-messages/

regards

Is does work for you?

I would probably just add this message into the model rules and use the Compare Validator - http://www.yiiframework.com/doc/api/1.1/CCompareValidator

In the model rules:




...

array('expiry_date', 'compare', 'compareAttribute'=>'notification_days', 'operator'=>'>=', 'message'=>'Please enter the company license expire date more than notification days'),

...