title: Model method "addError" doesn't work in yii2
body: <p>I have build a customized login form in yii2, the source code looks like this:</p>
  
  <pre><code>&lt;?php
  
  /* @var $this yii\web\View */
  /* @var $form yii\bootstrap\ActiveForm */
  /* @var $model app\models\LoginForm */
  
  use yii\helpers\Html;
  use yii\bootstrap\ActiveForm;
  use yii\captcha\Captcha;
  
  $this-&gt;title = 'Login';
  $this-&gt;params['breadcrumbs'][] = $this-&gt;title;
  ?&gt;
  
  &lt;div class="card-body login-card-body"&gt;
      &lt;p class="login-box-msg"&gt;Вход&lt;/p&gt;
  
  
      &lt;?php $form = ActiveForm::begin([
          'id' =&gt; 'login-form',
          'layout' =&gt; 'horizontal',
          'method' =&gt; 'post',
          'fieldConfig' =&gt; [
              'options' =&gt; [
                  'tag' =&gt; false,
              ],
               'template' =&gt;'{input}'
          ],
      ]); ?&gt;
          &lt;div class="form-group has-feedback"&gt;
              &lt;?= $form-&gt;field($model, 'username')-&gt;textInput(['class' =&gt; 'form-control',
                  'placeholder' =&gt; 'Логин']); ?&gt;
              &lt;span class="fa fa-user form-control-feedback"&gt;&lt;/span&gt;
              &lt;p class="help-block help-block-error "&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class="form-group has-feedback"&gt;
              &lt;?= $form-&gt;field($model, 'password')-&gt;passwordInput(['class' =&gt; 'form-control',
                  'placeholder' =&gt; 'Пароль']); ?&gt;
              &lt;span class="fa fa-lock form-control-feedback"&gt;&lt;/span&gt;
              &lt;p class="help-block help-block-error "&gt;&lt;/p&gt;
          &lt;/div&gt;
           &lt;div class="row"&gt;
               &lt;div class="col-8"&gt;
               &lt;?= $form-&gt;field($model, 'captcha')-&gt;widget(Captcha::className(),
                   ['captchaAction' =&gt; 'panel/captcha','template' =&gt; '&lt;div class="captcha_img"&gt;&lt;a href="#"&gt;{image}&lt;/a&gt;
                      &lt;/div&gt;'
                       . 'Капча{input}',
                   ])-&gt;label(FALSE); ?&gt;
               &lt;/div&gt;
  
           &lt;/div&gt;
      &lt;br&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-8"&gt;
                  &lt;div class="checkbox icheck"&gt;
                      &lt;label&gt;
                          &lt;input type="checkbox"&gt; Запомнить
                      &lt;/label&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;!-- /.col --&gt;
              &lt;div class="col-4"&gt;
  
                  &lt;?= Html::submitButton('Вход', ['class' =&gt; 'btn btn-primary btn-block btn-flat',
                      'name' =&gt; 'login-button']) ?&gt;
  
              &lt;/div&gt;
              &lt;!-- /.col --&gt;
          &lt;/div&gt;
  
          &lt;?php ActiveForm::end(); ?&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>As you can see i have ActiveForm stripped of auto generated tags, and stripped off labels. I have a standard form model from yii2-base-app, which handles the auth, model:</p>
  
  <pre><code>&lt;?php
  
  namespace app\models;
  
  use Yii;
  use yii\base\Model;
  
  /**
   * LoginForm is the model behind the login form.
   *
   * @property User|null $user This property is read-only.
   *
   */
  class LoginForm extends Model
  {
      public $username;
      public $password;
      public $rememberMe = true;
      public $captcha;
  
      private $_user = false;
  
  
      /**
       * @return array the validation rules.
       */
      public function rules()
      {
          return [
              // username and password are both required
              [['username', 'password','captcha'], 'required'],
              // rememberMe must be a boolean value
              ['rememberMe', 'boolean'],
              // password is validated by validatePassword()
              ['password', 'validatePassword'],
              ['captcha', 'captcha', 'captchaAction'=&gt; 'panel/captcha']
          ];
      }
  
      /**
       * Validates the password.
       * This method serves as the inline validation for password.
       *
       * @param string $attribute the attribute currently being validated
       * @param array $params the additional name-value pairs given in the rule
       */
      public function validatePassword($attribute, $params)
      {
          if (!$this-&gt;hasErrors()) {
              $user = $this-&gt;getUser();
  
              if (!$user || !$user-&gt;validatePassword($this-&gt;password)) {
                  $this-&gt;addError($attribute, 'Incorrect username or password.');
              }
          }
      }
  
      /**
       * Logs in a user using the provided username and password.
       * @return bool whether the user is logged in successfully
       */
      public function login()
      {
          if ($this-&gt;validate()) {
              return Yii::$app-&gt;user-&gt;login($this-&gt;getUser(), $this-&gt;rememberMe ? 3600*24*30 : 0);
          }
          return false;
      }
  
      /**
       * Finds user by [[username]]
       *
       * @return User|null
       */
      public function getUser()
      {
          if ($this-&gt;_user === false) {
              $this-&gt;_user = User::findByUsername($this-&gt;username);
          }
  
          return $this-&gt;_user;
      }
  }
  </code></pre>
  
  <p>The login works fine, however <code>$this-&gt;addError($attribute, 'Incorrect username or password.');</code> this line doesn't really work. When the debugger hits it nothing happens in the browser, if i put invalid login/pass no error messages added to the input. How can i fix this?</p>