<?= $form->field($model, 'SRF_STUDENT_ID')->dropdownList(
ArrayHelper::map(StudentDetails::find()->all(),'STUDENT_REGISTRATION_ID','STUDENT_REGISTRATION_ID'),
['prompt'=>'Select Student Id']); ?>
如何在下拉列表中设置条件。我希望从StudentDetails中选择STUDENT_REGISTRATION_ID,其中is_select = 0; 数据结果集下拉列表。请帮助我。
答案 0 :(得分:1)
试试这个:
<?= $form->field($model, 'SRF_STUDENT_ID')->dropdownList(
ArrayHelper::map(StudentDetails::find()->where(['is_select' => 0])->all(),'STUDENT_REGISTRATION_ID','STUDENT_REGISTRATION_ID'),
['prompt'=>'Select Student Id']); ?>