Dropdown list , options


I have my database table :

currency(id, c_code, c_name);

on my view :


$currency = CHtml::listData(FiCurrency::model()->findAll(array('order' => 'id')), 'id', 'c_code');

echo $form->dropDownListRow($model, 'currency',$currency);


This works very well,(list of codes) but I need to show in the list code+name

c_code c_name

c_code _c_name

c_code _c_name

How can I do this please?

If U check this :


U will see that U can pass function instead of attribute name, something like

$currency = CHtml::listData(FiCurrency::model()->findAll(array(‘order’ => ‘id’)), ‘id’, function (FiCurrency){

return CHtml::encode($this->c_code.$this->c_name);


check this out