Reputation: 579
If I have the following form field (code below) how can I set the field as required within my model so that like other fields the form cannot be submitted without it containing information.
<?= $form->field($model, 'seo[seo_title]')->textInput(['maxlength' => 60])->label('SEO Title') ?>
Upvotes: 5
Views: 3363
Reputation: 133400
Add the value
for te textinput in the options eg:
<?= $form->field($model, 'seo[seo_title]')->textInput(['maxlength' => 60], 'value'=> $yourValue )->label('SEO Title') ?>
or if you only need these fields required mark required in the model
Upvotes: 1