Hello guys. I am working at CJuiAutoComplete. Now this is my function in controller

public function actionAutoCompTest($term)


    $keywords = end(explode(', ',$term));

    $term = $keywords;

    $data = RFI::model()->findAll("rfi_no LIKE '%" . $term . "%'");

    foreach ($data as $m)


        $results[] = array('id' => $m->id, 'value' => $m->rfi_no);


    echo CJSON::encode($results);


and this is my widget


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









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

                            $( "#rfi_no" ).val(ui.item.value);

                            return false;


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

                                $("#rfi_id").val($("#rfi_id").val()+ " - " +;





i want to set rfi_no textbox (in whcih suggestion is placing) empty after selection.

any idea what option should be used for that or can we do it in select option??

also i tried to $(’#rfi_no’).val(’’); in select option but it didn’t work.


Try adding:

    $("#rfi_id").val($("#rfi_id").val()+ " - " +;


Tried it but not working… also describe it in last of my topic

Still waiting for help dudes…

Just now I understood what you need…

So you would like to empty the input field after the value is selected…

To do that you need to use setTimeout() because the input field gets the selected value after ‘select’ is executed…

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

	$("#rfi_id").val($("#rfi_id").val()+ " - " +;



And the ‘focus’ part is not needed… you can completely remove it…