Yii Cjuiautocomplete Values Are Not Getting Displayed

I apologise if this is already exists but i could not get it to work… I need to show the names and store the id’s in my table. these name are coming from other model(table). i’m getting the names and id’s when i inspect elts in chrome network inspector… but values are not not visible…but they are populating when i try to click on them its coming up in alert box with id…

can anyone pls help me to get names visible --thanks for ur help

my _form.php is something like this:

<div class="row">

        <?php echo $form->labelEx($typeModel,'benefit_type'); ?>


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




    'value'=>'Please select',





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


                                        // $('#organisation_id').val(ui.item.id);








    )); ?>

    <?php echo $form->error($typeModel,'benefit_type'); ?>

extension class for getting the names and id’s is:

 <? class EAutoCompleteAction extends CAction


        public $model;

        public $attribute;

        public $id;

        private $results = array();

        public $returnVal = '';

        public function run()


            if(isset($this->model) && isset($this->attribute)) {

                $criteria = new CDbCriteria();

                $criteria->compare($this->attribute, $_GET['term'], true);

                $model = new $this->model;

                foreach($model->findAll($criteria) as $m)


                   // $this->results[] = $m->{$this->attribute};

                    //$this->results[] = $m-<{$this->id};

                    $this->results[] = array(

                        'name' => $m->{$this->attribute},

                            'id'=> $m->id


                    /* $this->returnVal .= $m->getAttribute('name').'|'

                    .$m->getAttribute('id'). "\n"; */



            echo CJSON::encode($this->results);




and my Controller is some thing like this:

public function actions()


        return array(



                        'model'=>'BenefitType', //My model's class name

                        'attribute'=>'name', //The attribute of the model i will search




–any help would be highly appreciable

Thanks in advance


try this it may help you

Thanks for the link