Dropdownlist Disabled Options

Suppose I have:


<?php echo $form->dropDownList($model, 'selections', $model->getSelections()); ?>


public function getSelections()

{

    return CHtml::listData($this->findAll(), 'id', 'name');

}

I want to pass an array of IDs to this dropDownList - these IDs will correspond to option values that need to be disabled in the dropDownList.

How can I achieve this?

You can use the ‘options’ key in the htmlOptions of the dropDownList - see: activeDropDownList


$form->dropDownList($model, 'selections', $model->getSelections(), array('options'=>array(

        'value1'=>array('disabled'=>true,'label'=>'value 1'),

        'value2'=>array('label'=>'value 2'),

    )<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/wink.gif' class='bbc_emoticon' alt=';)' />)