title: $this->addError is not working in yii model class
body: <p>I am trying to do the custom validation.All is working fine except <strong>$this->addError</strong> .<br>
  It is not adding the error as it should. this is my controller action</p>
  
  <pre><code>public function actionVerifyAnswer()
      {
  
          if(isset(Yii::app()-&gt;session['_emailId']))
          {
          $model=new LoginForm;
          $model-&gt;scenario='verifyAns';
          if(isset($_POST['LoginForm']))
          {
  
              $model-&gt;attributes=$_POST['LoginForm'];
              if($model-&gt;validate())
              {
              $theQuestion=$model-&gt;secretQuestion;
              $theAnswer=  strtolower($model-&gt;verifyAnswer);
              $usersModel=new Users;
  
              $emailUser=  Yii::app()-&gt;session['_emailId'];
  
              $userRecord=$usersModel-&gt;find('loginEmail=:email AND secretQuestion=:que',array(':email'=&gt;$emailUser,':que'=&gt;$theQuestion));
              if(empty($userRecord))
              {   
                  throw new CHttpException('You have selected the wrong question');
              }
              else
              {
                  $usersAnswer=  strtolower($userRecord-&gt;secretAnswer);
                  if($theAnswer === $usersAnswer)
                  {
  
                      $this-&gt;redirect('changePassword');
                  }
                  else
                  {
  
                      throw new CHttpException('you have given the wrong answer');
                  }
              }
  
  
          }
          else
          {
              throw new CHttpException('model-&gt;validate()');
          }
          }
          else
          {
  
               $secretQuestion= Yii::app()-&gt;params['secretQuestion'];
                 $this-&gt;render('verifyAnswer', array('model'=&gt;$model,
                                                      'secretQuestion'=&gt;$secretQuestion,
  
                     ));
          }
          }
          else
          {
  
             Yii::app()-&gt;user-&gt;loginRequired();
          }
  
      }
  </code></pre>
  
  <p>and this is my <strong>custom validation</strong> in the model</p>
  
  <pre><code>public function checkQuestion()
      {
          if(!$this-&gt;hasErrors())
          {
              $model=new LoginForm;
              $theQuestion=$this-&gt;secretQuestion;
              $usersModel=new Users;
              $emailUser=  Yii::app()-&gt;session['_emailId'];
              $userRecord=$usersModel-&gt;find('loginEmail=:email AND secretQuestion=:que',array(':email'=&gt;$emailUser,':que'=&gt;$theQuestion));
              if(empty($userRecord))
              {   
                  //this line is not working
  
                  $this-&gt;addError('secretQuestion', 'Incorrect Combination');
  
                  //if i throw exception here. Then exception is working
              }
          }
      }
  </code></pre>
  
  <p><strong>How can i make $this->addError working?</strong></p>