Search code examples
phpyiiyii-chtml

$htmlOptions is not working in CHtml::dropDownList Yii


I have this implementation of CHtml:

<?=CHtml::dropDownList('id_sistema', $Proveedor[0]['id_sistema'],CHtml::listData(Sistemas::model()->findAll(),'sistema_id', 'sistema_nombre'),array('empty' => 'Selecciona un sistema...'),array('class'=>'form-control chosen-select'));?>

But is so weird that is not recognizing the 'form-control' css class. I have read several times the documentation and I can not find de issue.

I someone have any idea, I will appreciate it!


Solution

  • have you tried this one?

    <?=CHtml::dropDownList('id_sistema', $Proveedor[0]['id_sistema'],CHtml::listData(Sistemas::model()->findAll(),'sistema_id', 'sistema_nombre'),array('empty' => 'Selecciona un sistema...', 'class'=>'form-control chosen-select'));?>
    

    http://www.yiiframework.com/wiki/48/by-example-chtml/#hh5

    Html Options is on the 4th parameter of the dropDownList