Cjuiautocomplete On Focus

Hi

does anyone knows how could the CJuiAutoComplete widget display the options

on textfield focus without typing anything ?

thanks!

Hello. Usually I added script to trigger the autocomplete on focus. First of all I set the minLength to 0 :




$this->widget('zii.widgets.jui.CJuiAutoComplete', array(

        ...

        'options'=>array(

          'minLength'=>'0',

        ),

        ...



Then I add script :




<script>

$("#input-here").bind('focus', function(){ $(this).autocomplete("search"); } );

</script>



Thanks Putera.

It works!

Bravo Putera :)

You’re welcome ;)

Hi, can’t aplly this in my autocomplete:

  1. What mean #input-here. Is it id of field element like this?



<input id="input-here" class="ui-autocomplete-input" type="text" name="input-here" autocomplete="off">



  1. What mean "search"? Is it a link to my controller method?

Hello. #input-here is the id of the input. So yes, your example <input id="input-here" … > is correct. Regarding the "search", you could define your autocomplete options there. Could you please show the error message ? And why would you set autocomplete off at your input ?