Как в activeDropDownList указать выбранный элемент(selected)?
<?php echo CHtml::activeDropDownList($model,'list',array('label1'=>value1,'label2'=>value2)); ?>
Как в activeDropDownList указать выбранный элемент(selected)?
<?php echo CHtml::activeDropDownList($model,'list',array('label1'=>value1,'label2'=>value2)); ?>
class ColorModel extends CModel {
public $color = 'red';
public function attributeNames()
{
return array('color' => 'Цвет');
}
}
$model = new ColorModel();
echo CHtml::activeDropDownList($model,'color',array('blue' => 'Blue color','red' => 'Red color', 'green' => 'Green color'));
Будет выбран "red".