Search code examples
phphtmltemplatesyiiradiobuttonlist

How to add another element to Yii radioButtonList template?


I need the radioButtonList with tooltip after each element.

I use this code:

<?php echo $form->radioButtonList($model, 'Field', CHtml::listData(FieldDataModel::model()->findAll(), 'id', 'name')); ?>

and get following result:

[x] ParamName0
[ ] ParamName1
[ ] ParamName2

How can I get such result:

[x] ParamName0 [?]-(Link, that shows description. Description is taking from FieldDataModel)
[ ] ParamName1 [?]
[ ] ParamName2 [?]

May be, templates like 'template' => '{input} {label}' can help me?


Solution

  • That's not possible with the current implementation. You have to loop over your list data and create the buttons manually with CHtml::radioButton() or CHtml::activeRadioButton().