radioButtonList 默认选中 [英] radioButtonList checked by default

查看:41
本文介绍了radioButtonList 默认选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含 2 个选项的选项列表:是和否,如下所示

I created a option list with 2 options: Yes and No like below

<?php echo $form->radioButtonList($model,'active', array(1=>'Yes', 0=>'No'), array('separator'=>"" )); ?>

如何将选项 1 设置为默认选择?

How can I set option 1 to be selected by default ?

推荐答案

您必须在控制器中设置 $model->active = 1.

You have to set $model->active = 1 in your controller.

这篇关于radioButtonList 默认选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆