我正在尝试输出 CHtml::radioButtonList (yii 1.1.14),每个渲染元素看起来如下所示:
<input id="option_0" type="radio" name="MyForm[customOption_id]" value="1" data-ref="a string contained in table, column ref">
<label for="option_0">Some option</label>
让我头疼的是 data-ref 属性。
代码
<li>
<?php
echo $form->radioButtonList(
$model,'refinement_id',
CHtml::listData($refinements, 'id', 'label'),
array('separator'=>'</li><li>', 'container' => ''));
?>
</li>
我想为每个输出一个 data-ref 属性,然后我可以在某些 JavaScript 中使用它。
据我所知,我无法将其添加到 radioButtonList 的 htmlOptions 数组中,因为我只能在此处提供静态值。
非常感谢这里的任何指针或有人告诉我我在吠叫错误的树。