There is a form
<?=$form->field($model, '_author')->label('Имя')?> <?=$form->field($model, '_email')->label('Email')?> <?=$form->field($model, '_comment')->label('Комментарий')->textArea(['rows' => 3])?> <div class="form-group"> <div class="col-lg-offset-0 col-lg-1"> <?= Html::submitButton('Update', ['class' => 'btn btn-primary']) ?> </div> </div> <?php ActiveForm::end() ?> And handler
public function editComment($id) { $comment = Comments::findOne($id); $comment->author = $this->_author; $comment->comment = $this->_comment; $comment->email = $this->_email; return $comment->save(); } Validation Rules
public function rules() { return [ [['_author', '_comment', '_email'], 'required'], [['_author', '_comment'], 'string'], ['_email', 'email'] ]; } When updating data with validation, the update does not occur. The $model->validate() method returns false although the data is valid. You have to use $comment->save(false) . I just can not understand what could be the problem?