Yii Framework Forum: Autocomplete Not Responding On Tabular Input - Yii Framework Forum

Jump to content

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

Autocomplete Not Responding On Tabular Input Rate Topic: -----

#1 User is offline   nairgh 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 05-October 13

Posted 26 February 2014 - 10:34 AM

Hi, I am using the auto complete on a tabular input form. It is perfectly working on the main form, when i call the child form like this the auto complete is not working at all. What i am doing wrong. Any help or suggestion is really appreciated.

Yii::app()->clientScript->registerScript('vctranRow', "var lastTran = 0,a=1 ;
    var trTran = new String(" .
        CJSON::encode($this->renderPartial('form/_vctranRow', array('id' => 'idVcr', 'model' => new VcTran, 'form' => $form, 'this' => $this), true, false)) .
        ");
    function addTran(button)
    {
        lastTran++; a++
        button.parents('table').children('tbody').append(trTran.replace(/idRep/g, lastTran));
    }


    function deleteTran(button)
    {
        button.parents('tr').detach();
    }
");
 




_vctranRow.php

 
<tr>
 <td>
 <?php echo $form->textField($model, "[$id]vc_dr_type",array('size' => 2, 'maxlength' => 2)); ?>
 </td>
	
<td>
<?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
	'model'=>$model,   
        'attribute'=>'vc_dr_ac',
        'id'=>'id',
	'source'=>$this->createUrl('request/suggestAccount'),
	'options'=>array(
		'delay'=>300,
		'minLength'=>1,
		'showAnim'=>'fold',
	),
	'htmlOptions'=>array(
		'size'=>'20'
	),
   )); 
   ?>
</td>
</tr>

0

#2 User is offline   waitforit 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 414
  • Joined: 09-February 11

Posted 26 February 2014 - 01:06 PM

I think you need to reinitialize the autocomplete after cloning.
1

#3 User is offline   nairgh 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 05-October 13

Posted 27 February 2014 - 11:28 AM

View Postwaitforit, on 26 February 2014 - 01:06 PM, said:

I think you need to reinitialize the autocomplete after cloning.


Thanks for the reply. Basically the child form is calling from the main form which is already initialized like this..

$form=$this->beginWidget('CActiveForm', array(
	'id'=>'idV1',
         ...,
     <?php
            foreach ($model->vctrans as $id => $vctran) {
                $this->renderPartial('form/_vctranRow', array('id' => $id, 'model' => $vctran, 'form' => $form, 'this' => $this), false, true);
            }
            ?>   
 <?php $this->endWidget();   ?>


Then is there a need for re initilization.
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