Multiselect Dependent Dropdown

Hi,

I implemented the dependent dropdown properly. But when I tried to change the dropdownlist to multi-select dropdown, I am unable to pass all the selected values to the controller via ajax data. By below method, I am able to pass one value. But how do I pass more than one value ?





 echo $form->dropDownList($model, 'cityList',

    CHtml :: listData(City:: model()->findAllByAttributes(array('in_group'=>'city')), 'id', 'name'),

        array(

	   'multiple'=>'multiple',

	    'ajax' => array(

            'type' => 'POST',

            'url' => Yii::app()->createUrl('site/getstreet') ,		

	   'data'=> array('cityy' => 'js:this.value' ),         

           'update'=>'#street',

            'success' => 'function(data){	

				

				//myfunction

                

            }',					

            ),

            

        ));






it will send the id’s of selected options as string to the server

NOTE: its likely gonna do more than one ajax i have not tested it




<?php echo $form->dropDownList($model, 'cityList', City:: model()->findAllByAttributes(array('in_group'=>'city')), 'id', 'name'), [

	'multiple'=>'multiple',

	'ajax' => array(

		'type' => 'POST',

		'url' => Yii::app()->createUrl('site/index'),

		'data'=>['city'=>'js:this.value'],

		'update'=>'#street',

		'beforeSend'=>'js:function(xhr){this.data=encodeURI( "city=" + $("#cityList").val().join(",") );}',

		'success'=>'js:function(data) {console.log(data);}'

	),

]); ?>



Thanks for your reply. I found a simple way. I got all the values selected directly inside the controller using $_POST.