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
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'id'=>'rfi_no',
'name'=>'rfi_no',
'sourceUrl'=>$this->createUrl('RFIs/autoCompTest'),
'htmlOptions'=>array(
'size'=>'30'
),
'options'=>array(
'showAnim'=>'fold',
'focus'=>'js:function( event, ui ) {
$( "#rfi_no" ).val(ui.item.value);
return false;
}',
'select'=>'js:function(event, ui) {
$("#rfi_id").val($("#rfi_id").val()+ " - " + ui.item.id);
}',
),
));
?>
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.