Yii Framework Forum: Select2 In Yiibooster - Yii Framework Forum

Jump to content

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

Select2 In Yiibooster Rate Topic: -----

#1 User is offline   aslan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 02-April 12

Posted 25 August 2013 - 11:47 AM

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?
0

#2 User is offline   aslan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 02-April 12

Posted 25 August 2013 - 12:08 PM

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 :P
    'options' => array(
        'tags' => array('a','b', 'c', 'd'),
        'placeholder' => 'Tags',
        'tokenSeparators' => array(',', ' ')
)));?>

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