Answer the question
In order to leave comments, you need to log in
[[+content_image]]
Why doesn't check for required fields work in yii2?
Why doesn't check for required fields work in yii2? The model has a rule
public function rules()
{
return [
[['title'], 'required'],
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<div class="form-group field-news-title required">
<label class="control-label" for="news-title">Заголовок</label>
<input type="text" id="news-title" class="form-control" name="News[title]" maxlength="255" aria-required="true">
<div class="help-block"></div>
</div>
Answer the question
In order to leave comments, you need to log in
Look at the console, what's there., maybe js errors. Perhaps the field is not empty, perhaps the validation scripts did not connect at all or do not see the selectors. A million options. It's hard to tell from this description what exactly happened.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question