Answer the question
In order to leave comments, you need to log in
[Yii2] How to add id to form fields when using ActiveForm?
Hello.
Actually a subject.
Available:
<?php $form = ActiveForm::begin(['id' => 'form-add-video']); ?>
<?= $form->field($model_video_form, 'name')->label('Название (для отображения в списке)') ?>
...
Answer the question
In order to leave comments, you need to log in
<?= $form->field($model, 'name', [
'inputOptions' => [
'id' => 'uniqueID',
],
])->label('Название') ?>
<?=$form->field($model_video_form,'name',['id'=>'field_id'])->label('..')?>
<?=$form->field($model_video_form,'name',['options' => ['id'=>'field_id']])->label('..')?>
For example like this:
<?php $form = ActiveForm::begin(['id' => 'form-add-video']); ?>
<?= $form->field($model_video_form, 'name')->textInput(['id' => 'your_id', 'placeholder' => 'your place holder'])->label('Название (для отображения в списке)') ?>
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question