2014-01-13 16 views
0

我將YiiBooster與Yii一起使用來生成表單。YiiBooster radioButtonListRow無法正常工作

大部分表單工作 - typeahead,複選框和輸入行都很好。當我嘗試使用radioButtonListRow,它呈現的不是文本爲我的標籤模板文本({labelTitle} {ENDLABEL}):

<?php echo $form->radioButtonListRow(
      $model, 
      'radioButtons', 
      array(
       'Option one', 
       'Option two', 
      ) 
     ); ?> 

導致HTML

<div class="control-group"> 
    <label class="control-label" for="Surveys_radioButtons">GCSE Maths</label> 
    <div class="controls"> 
     <input id="ytSurveys_radioButtons" type="hidden" value="" name="Surveys[radioButtons]"> 
      <span id="Surveys_radioButtons"> 
      <input id="Surveys_radioButtons_0" value="0" type="radio" name="Surveys[radioButtons]"> 
      {labelTitle}{endLabel} 
      <input id="Surveys_radioButtons_1" value="1" type="radio" name="Surveys[radioButtons]"> 
      {labelTitle}{endLabel} 
      </span> 
    </div> 
</div> 

上面的示例直接從YiiBooster examples複製,只更改屬性名稱。

任何人有任何想法我做錯了什麼?

回答

0

嗯,我比較了CHtml::radioButtonList的實現,我認爲問題出現在yii版本中。 只需將其更新到最新,一切都會好的。

+0

https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php#L1239 – Atorich

0

其修改爲

<?php 
echo $form->radioButtonListGroup(
     $model, 
     'radioButtons', 
     array(
      'Option one', 
      'Option two', 
     ) 
    ); 
?>