Autocomplete widget help

I want to use the autocomplete widget with the following code:




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

	'name'=>'test',

	'source'=>array('php', 'sql', 'yii'),

));



If i search for php, for example and is found, then i want to redirect to the url: /php. How can i achieve this? Thanks.

I guess you can do this task by calling a javascript function on select Option of CJuiAutoComplete




 'select'=>'js:function() {

           //do what ever you want..

        }'







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

        'name'=>'test',

        'source'=>array('php', 'sql', 'yii'),

        'select'=>'js:function() {

           //do what ever you want..

        }'

));



i get the following error: Property "CJuiAutoComplete.select" is not defined.

Yes exactly…select is not any property of a CJuiAutocomplete…

you should use it in Options array…Like this




 'options' => array(

        'minChars'=>3,

        'autoFill'=>false,

        'focus'=> 'js:function( event, ui ) {

            $( "#test_autocomplete" ).val( ui.item.name );

            return false;

        }',

        'select'=>'js:function( event, ui ) {

            $("#'.CHtml::activeId($model,'attribute_id').'")

            .val(ui.item.id);

            return false;

        }'

     ),




Or refer this Link for more information.

I want to catch the value of the id selected. If i try to output in the select event, alert(ui.item.id); then i get undefined.