如何在Yii高级模板中生成动态单选按钮?

时间:2016-01-14 07:43:25

标签: radio-button yii2

这是我的控制者:

$Shipping = Shipping::find()->all();
foreach ($Shipping as $key => $value) {
    pr($value['name']);
}die;

O:P/
Free
Pickup
Country Wise
API

我想用O:P生成单选按钮列表。如何?

1 个答案:

答案 0 :(得分:2)

如果单选按钮处于活动状态 你可以使用有效的radioList

<div class="col-sm-8 cngcolor">
                                <input type="color" id="background" name="background" value="#ffffff" list="colors" class="input-xs show-tick ng-pristine selectpicker form-control">
                                <datalist id="colors">
                                    <option>#ffffff</option>
                                    <option>#ff0000</option>
                                    <option>#000000</option>
                                </datalist>
                            </div>