Reputation: 2652
I want to add yii2 default error to the form that is created using only html tags:
<form>
<input type="text">
</form>
I just shorted the form. Actually it is very long and couldn't write with
<?= $form->field($model, 'model')->dropdownList([
1 => 'item 1',
2 => 'item 2'
],
['prompt'=>'Select Category']
);
?>
<?= $form->field($model, 'model')->textInput() ?>
<?= $form->field($model, 'model')->textarea(['rows' => '6']) ?>
even if I used costom template for each one. Because the design is very complex
Upvotes: 1
Views: 347
Reputation: 133370
You can use the $form->errorSummary($model)
eg:
<?php $form = ActiveForm::begin(); ?>
.......
<?= $form->errorSummary($model); ?>
....
Upvotes: 2