M
M
Maxim Lagoysky2017-05-16 12:14:37
Yii
Maxim Lagoysky, 2017-05-16 12:14:37

Change error class in yii2 field?

The default field is a div block with the class "has-error" or "has-access", how can I change these classes?

<div class="form-group field-post-title required has-error">

<label class="control-label" for="post-title">Title</label>
<input type="text" id="post-title" class="form-control" name="Post[title]" aria-required="true" aria-invalid="true">

<div class="help-block">Title cannot be blank.</div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-05-16
@lagoy

\yii\widgets\ActiveForm::begin([
    'errorCssClass' => 'my-css-class'
]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question