I have this radioList in yii2
Html::radioList('abc',null,$new,['class' => 'form-control input-sm']);
It generates this:
<div class=radio>
but I want:
<div class=radio-inline>
please help me
I have this radioList in yii2
Html::radioList('abc',null,$new,['class' => 'form-control input-sm']);
It generates this:
<div class=radio>
but I want:
<div class=radio-inline>
please help me
No. Let's say that $new = [1 => 'Hello', 2 => 'World']
;
The generated output will be:
<div class="form-control input-sm">
<label>
<input type="radio" name="abc" value="1"> Hello
</label>
<label>
<input type="radio" name="abc" value="2"> World
</label>
</div>
If you want to add radio class to container tag you can do it like that:
echo Html::radioList('abc', null, $new, ['class' => 'form-control input-sm radio']);
For each input it will be:
echo Html::radioList('abc', null, $new, [
'class' => 'form-control input-sm',
'itemOptions' => ['class' => 'radio'],
]);
Check the documentation, it's pretty clear.
I think this is proper solution
<?= $form->field($model, 'abc')->inline()->radioList(['example1' => 'example1', 'example2' => 'example2'])->label(false) ?>