, ,

how to make the multiple dropdown list can be selected in update option ?


As I am getting the value dynamical, So, I have to make the list dynamically according to databases saved id and following yii convention…$result = Product::model()->findAllBySql($query);

                $selectedlist = CHtml::listData($result,’ProductID’, ‘ProductID’);
$x =  array();
foreach ($selectedlist as $key => $value) {
}$list=CHtml::listData( Product::model()->findAllBySql(SELECT ProductID, ProductName
FROM product ORDER BY ProductName ASC’),’ProductID’, ‘ProductName‘);

echo $form->dropDownList($model,’ClientIDs’,$list, array(  ‘empty’=>’——Select multiple clients——‘,

                ‘value’ => ‘Y’,

============================== Another way==========

But, in this way, you will able to make the items selected but, that value you will not able to use, when update.

This is:

echo Chtml::dropDownList(‘ClientIDs’,$selected, $list, array(  ‘empty’=>’——Select multiple clients——‘,));

About these ads