Answer the question
In order to leave comments, you need to log in
How to design array for active form with multiple choice?
There is a model that contains the following data: site number (id), cost with equipment (value), cost without equipment (w_e_value) and the user ID to which the site is assigned (user_id).
It is necessary in some way (preferably) through the active form to implement the display of sites for selection.
It seems to have implemented the conclusion, but the choice is possible only one site.
How to correctly form an array so that it is possible to select several sites at the same time?
<? foreach ($standsModel as $stand):
$items[$stand->stand] = ['Площадь - '.$stand->area_space.' кв.м. Стоимость - '.$stand->value_equipped_playground.'р. Стоимость без оборудованния - '.$stand->value_not_equipped_playground.'р.'];
endforeach;
$params = [
'prompt' => 'Выберите стенд',
'multiple' => 'true'
];
echo $form->field($model, 'number_area_stand')->dropDownList($items, $params);
?>
Answer the question
In order to leave comments, you need to log in
$form->field($model, 'number_area_stand')->dropDownList($items, ['multiple' => true]);
Like so
echo $form->field($model, 'number_area_stand[]')->dropDownList($items, $params);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question