php - yiibooster TbSelect2 throws 'uncaught exception: query function not defined for Select2' when trying to open in modal -


i trying open form containing yiibooster tbselect2 in modal dialog using ajax call , renderpartial(). throws error:

uncaught exception: query function not defined select2 patient_state

it happens if try populate modal ajax call. works fine if load page form. please help!

here code: controller:

public function actioncreate() {     $model = new patient;     $this->_createupdate($model); }  private function _createupdate($model) {     if (isset($_post['patient'])) {         $model->attributes = $_post['patient'];         if ($model->save()) {             if (yii::app()->request->isajaxrequest) {                 echo cjson::encode($model->attributes);                 yii::app()->end();             } else {                 $this->redirect(array('admin'));             }         }     }      if (yii::app()->request->isajaxrequest) {         $this->renderpartial('_form', array('model' => $model), false, true);     } else {         $this->render('update', array('model' => $model));     } } 

form:

<?php /* @var $this patientcontroller */ /* @var $model patient */ /* @var $form cactiveform */ if (yii::app()->request->isajaxrequest) {     yii::app()->clientscript->scriptmap['jquery.js'] = false;     yii::app()->clientscript->scriptmap['jquery.min.js'] = false; } ?>  <div class="form" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">  <?php $form=$this->beginwidget('cactiveform', array(     'id' => 'patient-form',     'enableajaxvalidation' => false, )); ?>      <p class="note">fields <span class="required">*</span> required.</p> <div class="row">     <?php echo $form->labelex($model,'first_name'); ?>     <?php echo $form->textfield($model,'first_name', array('size' => 37,'maxlength' => 100)); ?>     <?php echo $form->error($model,'first_name'); ?> </div>  <div class="row">     <?php echo $form->labelex($model,'last_name'); ?>     <?php echo $form->textfield($model,'last_name', array('size' => 37,'maxlength' => 100)); ?>     <?php echo $form->error($model,'last_name'); ?> </div>  <div class="row">     <?php echo $form->labelex($model,'addr1'); ?>     <?php echo $form->textfield($model,'addr1', array('size' => 37,'maxlength' => 256)); ?>     <?php echo $form->error($model,'addr1'); ?> </div>  <div class="row">     <?php echo $form->labelex($model,'city'); ?>     <?php echo $form->textfield($model,'city', array('size' => 37,'maxlength' => 100)); ?>     <?php echo $form->error($model,'city'); ?> </div>  <div class="row">     <div class="inline">         <?php echo $form->labelex($model,'state'); ?>         <?php         $this->widget(             'booster.widgets.tbselect2',             array(                 'model'      =>  $model,                 'attribute'  =>  'state',                 'data'       =>  array('al' => 'alaska', 'ca' => 'california'),                     'value'      =>  $model->state,                 'options'    =>  array(                     'placeholder'  =>  'select',                 )             )         );         ?>         <?php echo $form->error($model,'state'); ?>     </div>     <div class="inline" style="margin-left: 10px;">         <?php echo $form->labelex($model,'postal_code'); ?>         <?php echo $form->textfield($model,'postal_code', array('size' => 10,'maxlength' => 10)); ?>         <?php echo $form->error($model,'postal_code'); ?>     </div> </div>  <div class="row">     <?php echo $form->labelex($model,'dob'); ?>     <?php echo $form->textfield($model,'dob', array('id'  =>  'dob-input')); ?>     <div id="dob-hints" class="hint">mm/dd/yyyy     </div>     <?php echo $form->error($model,'dob'); ?> </div>  <div class="row buttons">     <?php     if ($model->isnewrecord) {         $buttonlabel =  'create';         $url = $this->createurl('create');     } else {         $buttonlabel =  'save';         $url = $this->createurl('update', array("id" => $model->id));     }     ?>     <?php $this->widget(         'booster.widgets.tbbutton',         array(             'label' => $buttonlabel,             'context' => 'primary',             'buttontype' => 'link',             'htmloptions' => array(                 'id' => 'submit-button',                 'onclick' => 'submit();')         )     );     ?> </div>  <?php $this->endwidget(); ?>  </div><!-- form --> 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -