Question already exists with answer (below link), but: 1) doesn't work for me 2) doesn't include the added need to have a selected option
Can help?
IM USING:
<?=$form->field($invoice, 'id')
->dropDownList(ArrayHelper::map($some_items_array, 'value_field', 'show_field'), [
'options' => [
$some_selected_id => ['Selected'=>true]],
'data' => ['attrib1' => "valueA', 'attrib2' => "valueB']
'class' => 'form-control',
'prompt' => ''])->label(false);
?>
I NEED, BUT DO NOT GET:
<select name="name">
<option value="value" data-attrib1="valueA" data-attrib2="valueB">text< option>
</select>