I need multi selection on dropdown. There are dropdown
<?= $form->field($model, 'referal_id')->dropDownList(
ArrayHelper::map(User::find()->all(),'id','fullname'),
['prompt' => 'Select Referal...']
) ?>
I need multi selection on dropdown. There are dropdown
<?= $form->field($model, 'referal_id')->dropDownList(
ArrayHelper::map(User::find()->all(),'id','fullname'),
['prompt' => 'Select Referal...']
) ?>
<?= $form->field($model, 'referal_id')->dropDownList(
ArrayHelper::map(User::find()->all(),'id','fullname'),
[
'prompt' => 'Select Referal...',
'multiple' => true //set this option
]
) ?>
And don't forget that your post will be array now. I supose that you store that information in another table so you'll have to set new property like referals, and change multiselect property with it. ($form->field($model, 'referals'))
After that just foreach it and save it like:
if($model->referals){
foreach($model->referals as $user_id){
//save in another table linked to $model->id
}
}