如何从radiobuttonlist中分离单选按钮并将其设置为默认值

时间:2013-09-26 04:08:43

标签: yii yii-events

我是Yii框架的新手。我在高级搜索表单中使用了两个radiobuttonlist。我正在使用以下行创建radiobuttonlist。

<div class="row">
        <?php #echo $form->label($model,'ReviewedDate'); ?>     
                <?php echo $form->radioButtonList($model, 'ReviewedDate', 
        array('1' => 'Reviewed', '' => 'Not Reviewed')
    ); ?>
    </div>

       <div class="row"> 
                <?php echo $form->radioButtonList($model, 'Approved', 
        array('0' => 'Rejected', '1' => 'Approved')
    ); ?> 
    </div> 

现在,我想从radiobuttonlist创建一个单独的radiobutton(4个按钮 - Approved,Rejected,Review,Not Review),并且当我转到该页面时,默认情况下必须选择Not reviewed。时间只能选择一个按钮。我怎么能这样做

1 个答案:

答案 0 :(得分:0)

尝试:

        <div class="row">
            <?php #echo $form->label($model,'ReviewedDate'); ?>     
                    <?php echo $form->radioButtonList($model, 'ReviewedDate', 
            array('1' => 'Reviewed', '' => 'Not Reviewed','2'=>'Approved','3'=>'Reviewed','4'=>'rejected'
        ); ?>
        </div>
<script> $( document ).ready(function() {
      $('your id /selector radio button').prop('checked',true);
    }); </script>