Select2 In Yiibooster

there are two forms in the same page

form 1:





<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(

    'id'=>'form-aa',

)); ?>


......


<?php $this->widget('bootstrap.widgets.TbSelect2', array(

    'asDropDownList' => false,

    'name' => 'Post[tags]',

    'options' => array(

        'tags' => array('taga','tagb', 'tagc'),

        'tokenSeparators' => array(',', ' ')

)));?>


......




form 2:





<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(

    'id'=>'form-bb',

)); ?>


......


<?php $this->widget('bootstrap.widgets.TbSelect2', array(

    'asDropDownList' => false,

    'name' => 'Post[tags]',

    'options' => array(

        'tags' => array('tag1','tag2', 'tag3'),

        'tokenSeparators' => array(',', ' ')

)));?>


......




in such way, the first TbSelect2 is rendered correctly, but the second one failed.

I’ve tried add different ids to the two form as well as the two TbSelect2, but it did not work either.

Please how to solve the problem?

lol, i found the solution…




<?php $this->widget('bootstrap.widgets.TbSelect2', array(

    'asDropDownList' => false,

    'name' => 'Post[tags]',

    'htmlOptions' => array('id'=>'asdf'), // here to make them different <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />

    'options' => array(

        'tags' => array('a','b', 'c', 'd'),

        'placeholder' => 'Tags',

        'tokenSeparators' => array(',', ' ')

)));?>