Skip to content
Advertisement

How can i add select tag to search model in yii2?

here i want to select Airline from a list this is the code:

        <div class="col-lg-2">
          <?= $form->field($model, 'Airline') ?>  
        </div>
        <div class="col-lg-2">
            <?= Html::label('Bdate', 'Bdate') ?>              
            <?= Html::activeInput('date', $model ,'Bdate',['class'=>'form-control']) ?>
        </div>

Advertisement

Answer

<?= $form->field($model, 'some_column')->dropdownList(['1' => 'aaa', '2' => 'bbb'], ['prompt' => '---Select Data---']) ?> here is yii2 dropdown’s simplest view

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement