Autocomplete Not Responding On Tabular Input

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>



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.