加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 如何在yii2 RadioList()中预选/检查默认单选按钮?

发布时间:2020-12-13 18:19:43 所属栏目:PHP教程 来源:网络整理
导读:我希望在我的表单中预先选择单选按钮. ?= $form-field($model,'config')-radioList(['1'='Automatic Entry',2='Manual Entry']) -label('Barcode/Book No Generation'); ? 预选值取自$model- config.这意味着您应该将该属性设置为您想要预选的值: $model-co
我希望在我的表单中预先选择单选按钮.
<?= $form->field($model,'config')->radioList(['1'=>'Automatic Entry',2=>'Manual Entry'])
     ->label('Barcode/Book No Generation'); ?>
预选值取自$model-> config.这意味着您应该将该属性设置为您想要预选的值:
$model->config = '1';
$form->field($model,'config')->radioList([
    '1' => 'Automatic Entry','2' => 'Manual Entry',]);

相关文档是在ActiveForm课程中.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读