Move items from activeListBox to another one


I’m a new one to Yii components,

I’ve two activelistbox, the first one I bind it with data comes from the database as following:

    $list = CHtml :: listData(FacilitiesTest::model()->findAll('FACILITYTYPE_ID = 2'), 'FACILITY_ID', 'FACILITY_CODE');

echo CHtml :: activeListbox($model, 'FACILITY_CODE', $list, array('multiple' => 'multiple', 'size' => 3));

I need to select item(s) in the first one and move it to the second activelist box or move all.

the problem is:

how to dedicate the selected item(s), and how to do it with javascript

how to add items to the second activelistbox


This wiki might help.

It uses a Dropdownlist where the user can select multiple rows. When the form is submitted, the controller gets all the selected rows in an array (see "Another use case…").

The controller can then do with the data what it wants - maybe send it to the second listbox via ajax.

The wiki also uses ajax which should allow you to extract the data in the listbox, without submitting the form to the controller.