[Extension] jqAutocomplete

Hi there,

I just wanted to contribute Yii with my first extension that is a wrapper of an autocomplete plugin for jquery of my own creation.

Please, any feedback about it will be highly appreciated.

Here the link to the extension: jqAutocomplete

Hi Antonio

I’m using your extention, it’s very usefull, but I have a serious problem, when I use, two fields the behaviour its very strange.

If I write inside the second field, shows the autocomplete data of the first field, If I write inside the first field there is no autocomplete.

Someone had the same problem http://www.yiiframework.com/extension/jqautocomplete have a look to the last comment.

Here is my code:

<?php


Yii::import('ext.jqAutocomplete');


$json_options = array(


	'script'=> $this->createUrl('user/jsonCamera',array('json'=>'true','limit'=>6)) . '/input/',


	'varName'=>'camera',


	'shownoresults'=>true,


	'maxresults'=>6,


	//'callback'=>'js:function(obj){ $(\'#json_info\').html(\'you have selected: \'+obj.id + \' \' + obj.value + \' (\' + obj.info + \')\'); }'	


);





jqAutocomplete::addAutocomplete('#test_json_camera',$json_options);?>





<div class="row">


	<span class="ac_holder_camera">


			<?php echo $form->labelEx($modelUser->photographer,'Camera',array('class'=>'span-3')); ?>


			<?php echo $form->textArea($modelUser->photographer,'cameraCSV',array('rows'=>3, 'cols'=>60, 'size'=>15,'maxlength'=>128, 'id'=>"test_json_camera")); ?>


			<?php echo $form->error($modelUser->photographer,'cameraCSV'); ?>


	</span>


</div>





<?php


Yii::import('ext.jqAutocomplete');


$json_options = array(


	'script'=> $this->createUrl('user/jsonLens',array('json'=>'true','limit'=>6)) . '/input/',


	'varName'=>'lens', 


	'shownoresults'=>true,


	'maxresults'=>6,


	//'callback'=>'js:function(obj){ $(\'#json_info\').html(\'you have selected: \'+obj.id + \' \' + obj.value + \' (\' + obj.info + \')\'); }'	


);


jqAutocomplete::addAutocomplete('#test_json_lens',$json_options);?>

I tried to going deep inside the JS code, but I’m not familiar with, sorry.

It looks that last addAutocomplete refers to the first options, I tried with three fields and it’s the same!

Thanks a lot for your help