Cjuiautocomplete On Focus


does anyone knows how could the CJuiAutoComplete widget display the options

on textfield focus without typing anything ?


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(






Then I add script :


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


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 ?