Dropdown list , options

Hello

I have my database table :

currency(id, c_code, c_name);

on my view :


<?php 

$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 :

http://www.yiiframework.com/doc/api/1.1/CHtml#listData-detail

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

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