Dear folks,
currently I’m struggling with a muliple selectbox / listbox. I just can’t mark multiple entries at the same time. Reason: YII2\ActiveField does not correctly render the attribute “multiple” in the affected methods dropDownList() or listBox(). The output is multiple=“multiple” but this doesn’t work in the current browsers (Firefox, Edge…) in use of HTML 5.
Example:
<?= $form->field($model, 'brands')->listbox(
$dropDownListBrands,
['class'=>'chosen-select input-md required', 'size' => '6', 'multiple'=>'multiple']) ?>
Renders:
<label class="control-label" for="importer-brands">Brands</label>
<input name="Importer[brands]" value="" type="hidden">
<select id="importer-brands" class="chosen-select input-md required" name="Importer[brands][]" multiple="multiple" size="6">
<option value="1">VW</option>
<option value="2">Audi</option>
…
…
</select>
<div class="help-block"></div>
Using a simple "multiple" in the HTML tag would be successful:
<select id="importer-brands" class="chosen-select input-md required" name="Importer[brands][]" multiple size="6">
Changing the parameter to ‘multiple’ => ‘true’ in the parameter array of the Yii methods unfortunately has no effect.
Any ideas? It’s strange that I am obviously the only guy with this problem.
I use YII 2.0.15 on PHP 7.06.
thanks,
Tom