Yii Model Method Adderror Is Not Working


I have an issue about displaying error in a yii form.

This is my controller:

$custom_user->attributes = $_POST['CustomUser'];









  $custom_user->addError('username', 'Error X');






This is my index view:

<?php $form=$this->beginWidget('BaseForm', array(


                           'action'=>Yii::app()->createUrl('person/createUser'))); ?>

 <?php echo $form->errorSummary($user);?>

 <div class="right">

        <?php echo $form->textField($user,'username',array('size'=>30,'maxlength'=>255)); ?>

        <br/><?php echo $form->error($user,'username'); ?>




 <div style="float: left;">

        <?php echo $form->dateField($user,'valid_from',null,'valid_from_formated'); ?>

        <br/><?php echo $form->error($user,'valid_from'); ?>


Here is my BaseForm

public $enableClientValidation = true;

public $enableAjaxValidation = true;

public $clientOptions = array(  'hideErrorMessage'=>false,




                                'afterValidateAttribute' => 'js:enableSubmitAV',

                                'afterValidate' => 'js:submitFormAV');

Here is the problem:


is empty and noting is display under


But if I look in Firebug I can see that under "response" tab:

{"CustomUser_valid_until":["Valid Until must be greater than \"20121127\"."]}

it’s a good thing because it means my rules work great. But none errors are displayed. Not this one and even the error “Error X” I add in my controller is not diplayed… (I’m sure I pass throught the else statement, i tried it).

So, does anyone could have an idea? (What I need is display my form error)

Thanks for reading me and sorry for my approximate English.

Have a good day :)