I am using this radio button below.
http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#radioList()-detail
I create code as below and the radio list show up just fine.
echo $form->field($model, 'attribute1')
->radioList(
ArrayHelper::map(\app\models\MyList::find()->where(['groupid' => $groupid])->all(), 'id', 'itemname'),
['separator' => '<br>']);
But i do this for multiple instance of the same model in the same form. So the radio list being created all has same value for name attribute for example ‘mymodel-attribute1’ resulting in one group of radio list for all instance. So i want to change the radio list name attribute to make one radio list for each instance.
from the doc, radioList function parameter are as below
public static string radioList ( $name, $selection = null, $items = [], $options = [] )
But i get an error when doing any of these
echo $form->field($model, 'attribute1')
->radioList(
'radioname',
ArrayHelper::map(\app\models\MyList::find()->where(['groupid' => $groupid])->all(), 'id', 'itemname'),
['separator' => '<br>']);
echo $form->field($model, 'attribute1')
->radioList(
'radioname',
null,
ArrayHelper::map(\app\models\MyList::find()->where(['groupid' => $groupid])->all(), 'id', 'itemname'),
['separator' => '<br>']);
echo $form->field($model, 'attribute1')
->radioList(
'radioname',
[],
ArrayHelper::map(\app\models\MyList::find()->where(['groupid' => $groupid])->all(), 'id', 'itemname'),
['separator' => '<br>']);
so how to set the name attribute properly?
while searching the doc, i found bootstrap-activefield radiolist. Should i use this one instead?