yii 框架选择下拉列表中的值 [英] yii framework select the values in dropdownlist
问题描述
我是框架工作的新手.我需要填充下拉列表中的值.
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屋!