Hi.
I’m not sure I understand what you mean.
But generally speaking, to use the ‘name’ attribute and save the selected values, your view fiel should look like (I use the example from the extension page):
$my_colors = array('red','yellow','orange','black','green','blue');
$this->widget('ext.widgets.EchMultiselect', array(
'name'=>'colors',
'data'=>$my_colors,
'value'=>array(0,3),
'dropDownHtmlOptions'=> array(
'class'=>'span-10',
'id'=>'colors',
)
));
This will produce a dropdown list of the six colors.
‘red’ and ‘black’ will be preselected (because declared in ‘value’ attribute).
In your controller actionUpdate, $_POST[‘colors’] will be an array that contains the keys of the selected colors. If for example yellow, green and blue are selected before update, then $_POST[‘colors’] will be:
$_POST['colors'] = array(1, 4, 5);
Note that you have to save these selected values manually where you want to have them saved. That will not happen automatically!
In this example I could have a table ‘obj_color’, in which I want to store the selected colors for an object with the id $obj_id. I would have to save these values in the Update action like so:
foreach($_POST['colors'] as $color_id) {
$ocolor = new ObjColor;
$ocolor->obj_id = $obj_id;
$ocolor->color_id = $color_id;
$ocolor->save();
}
In any case, you will have to use a foreach-loop in your controller to loop through the selected values and process/save them.
Please take a look at the following post:
I also highly recommend this article: Handling Related Models in Yii Forms from Larry Ullman.
Hope this helps.
Best regards…