Ajax and Yii input

286 Views Asked by At

I'm using the YiiBoostrap widget 'TbSelect2' to create a mutli-select box that allows you type in a textbox and select options to a filtered list. Any selected are added into the textbox as a list.

This works when created on page load, however I need to use ajax to create the form inside a Yiibootstrap dialog to save page load times. When I use ajax it instead creates a traditional multi-select box, the ugly awkward to use one.

The code is exactly the same, it even works in a dialog, it only doesnt work when i use ajax to call the php. I'm sure there is something fundamental with YiiBooster that I'm missing, having never used it before.

but anyone know why this happens? Thanks!

Here's the code:

echo $form->labelEx($modelFao,'For the attention of');
     $this->widget('bootstrap.widgets.TbSelect2', array(
         'asDropDownList' => true,
         'data' => $admins,
         'name' => 'faoids',
         'id'   => 'faoids',
         'htmlOptions' => array (
             'multiple'  => 'multiple',
         ),
         'options' => array(
             'placeholder' => 'disciplines',
             'width' => '80%',
             'tokenSeparators' => array(',')
)));

The exact code is copied and pasted to be used again in the ajax call

0

There are 0 best solutions below