【问题标题】:YiiBooster radioButtonListRow not workingYiiBooster radioButtonListRow 不工作
【发布时间】:2014-01-13 14:51:55
【问题描述】:

我正在使用 YiiBooster 和 Yii 来生成一个表单。

大多数表单都有效 - 预输入、复选框和输入行都可以。当我尝试使用 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复制过来的,只是改变了属性名。

有人知道我做错了什么吗?

【问题讨论】:

    标签: php twitter-bootstrap yii yii-extensions


    【解决方案1】:

    嗯,我比较了CHtml::radioButtonList 的实现,我认为问题出在 yii 版本中。 只需将其更新到最新,一切都会好起来的。

    【讨论】:

      【解决方案2】:

      修改为

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多