Answer the question
In order to leave comments, you need to log in
Yii2 Active Form: how to hide error tag if there is no error text?
I am using Yii2. We have an Active Form. The form is listing the fields, here is one field for example:
<?= $form->field($model, 'name', [
template' => "
{label}
{input}
<span class=\"error\">{error}</span>"
]) ?>
<label class="control-label" for="signupform-name">Name</label>
<input type="name" id="signupform-name" class="form-control" name="SignupForm[name]">
<span class="error">Ошибка! Поле не заполнено</span>
<label class="control-label" for="signupform-name">Name</label>
<input type="name" id="signupform-name" class="form-control" name="SignupForm[name]">
<span class="error"></span>
<label class="control-label" for="signupform-name">Name</label>
<input type="name" id="signupform-name" class="form-control" name="SignupForm[name]">
<label class="control-label" for="signupform-name">Name</label>
<input type="name" id="signupform-name" class="form-control" name="SignupForm[name]">
<span class="error">Возникла какая-то ошибка!</span>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question