How can I access all the targetCars list items in my controller
What is the best way to save them to database using model ( table has simply two columns , user_id and car_id)
Thanks a lot for your help
( I read the documentation and I know how to get the selected value in the drop down list in controller , but here the case is moving from one list to another list and selecting all of them in the target list)
I tend to only use one multiselect dropdown that I dress up with jQuery (for example: http://quasipartikel.at/multiselect/ ). The selected elements are then passed down to the controller:
echo CHtml::dropDownList("sourceCars",
'',
CHtml::listData(MasterCars::model()->findAll(),'cars_code','car_name'),
array('multiple'=>'multiple',// added 'multiple'
'size'=>20
//'class'=> 'multiselect' if you use the above jquery widget
)
);
If you want to avoid doing that for whatever reason, adding ‘multiple’ to targetCars might do the trick. You will need to make sure your javascript marks whichever items it switches over as selected in the new box.
Thank You pommeverte for your response . I used Jquery and collected all the input and called controller from there . Things are working fine . Thanks for your advise