yii 框架选择下拉列表中的值 [英] yii framework select the values in dropdownlist

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

问题描述

我是框架工作的新手.我需要填充下拉列表中的值.

I am new to frame work. I need to populate the value in dropdownlist.

我使用以下代码在下拉列表中显示值

I used the following code to display the values in dropdown

echo $form->dropDownList($model,'pagetype', $Page_Type);?>

它在下拉列表中显示选项.

It displays the options in the dropdown.

我想填充下拉列表中的选定值.

I want to populate the selected value in the dropdown list.

保存的值在 $savedValues 数组中.

The saved values are in $savedValues array.

我不知道如何应用下拉列表中的选定选项.

I dont know how to apply the selected option in the dropdownlist.

推荐答案

你看过 CActiveForm::dropDownList 的文档 ?它会自动确定选定的选项,在这种情况下,它将是匹配的 $model->pagetype.

Have you read the documentation for CActiveForm::dropDownList ? It determines the selected option automatically, in this case it'll be the one matching $model->pagetype.

这篇关于yii 框架选择下拉列表中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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