Problem Mit Select2 Extention With Multiply

[twitter]patsch1980[/twitter]

Hi folks,

I’m trying to get the select2-ext running for hours now, but I didn’t get it right to fit my needs :unsure:

I’ve downloaded the last version from the yii-extention site…

The demo codes works very well but if I change it to my needs I don’t work as desired.

My needs: Multiply without tags.




        $data=array(

        '1'=>'Satu',

        '2'=>'Dua',

        '3'=>'Tiga',

        );

        // Multiple data

            $this->widget('ext.select2.ESelect2',array(

              'name'=>'name_of_the_component',

                'data'=>$data,

              'htmlOptions'=>array(

                'multiple'=>'multiple',

              ),

            ));




If I POST the data, I’m always only get the last selected value in the variable ‘name_of_the_component’ (e.g. name_of_the_component => “2”)

If I enable the tags, it works, but I don’t want the user to input new values…

If I enable the model with:




            $this->widget('ext.select2.ESelect2',array(

              'name'=>'[i]name_of_the_component[/i]',

                'data'=>$data,

                'model'=>$model,

            'attribute'=>'itemnumber',


              'htmlOptions'=>array(

                'multiple'=>'multiple',

              ),

            ));



…then the component isn’t rendered correct -> it get rendered as plain “html”-components (listfield, see attached image), but all values are listed as csv in a POST (e.g. content of the variable itemnumber => “Satu,Dua”)

Is this a bug or what am I doing wrong??

Thanks for reading :wink:

Okay, after trying other components (chosen, emultiselect) I got the "error"…

I think it was "chosen" which fired an exception when I used the property "name" and "model" simultaneous!

Then it goes wrong!

I removed the name property and then it works like desired… Puh :wink: