Yii Framework Forum: Problem Mit Select2 Extention With Multiply - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem Mit Select2 Extention With Multiply Unable to get all values with enabled option multiply Rate Topic: -----

#1 User is offline   patschwork 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 24-January 13

Posted 26 January 2013 - 07:18 AM

@patsch1980

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 ;-)

Attached File(s)


0

#2 User is offline   patschwork 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 24-January 13

Posted 26 January 2013 - 09:37 AM

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 ;-)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users