I Want To Show Mulitiselect Value In Dropdownlist

Hi Every one Thanks in advance :rolleyes:

i can able to save mulitiselect values to Db

but how to show in front screen multiselected values in dropdownlist

please any one help me


 <?php echo $form->dropDownList($model,'AllocationDepartment',CHtml::listData($Dept,'Department_Code','Department'),array('multiple'=>'true','prompt'=>'select ','selected'=>'selected'));

How you store selected values in database?

I found it working for me by below way:

let consider dropdown in view

$days = array(

'Sun'=&gt;'Sunday',


'Mon'=&gt;'Monday',


'Tue'=&gt;'Tuesday',


'Wed'=&gt;'Wednesday',


'Thu'=&gt;'Thursday',


'Fri'=&gt;'Friday',


'Sat'=&gt;'Saturday',

);

if(isset($model->id) && !empty($model->id))

{

&#036;model-&gt;working_days = explode('-', &#036;model-&gt;working_days);

}

echo $form->dropDownList($model, ‘working_days’, $days, array(‘multiple’=>true,‘selected’=>‘selected’));

add beforeSave method in model class

public function beforeSave() {

    // converting array to string


    if(&#33;empty(&#036;this-&gt;working_days))


    {


        &#036;this-&gt;working_days = implode(&quot;-&quot;, &#036;this-&gt;working_days);


    }


    return parent::beforeSave();


}