Autocomplete With Cjuiautocomplete

im trying to make an autocomplete filde that need to have a key=>value

like p_id=>p_name

and it not work at all!

i have try hours to do it witeout success :(

please help me…




  'source'=>'js: function(request, response) {


        url: "'.$this->createUrl('main/dynamicDropBox').'",

        type: "post",

        data: {


           tableTyp: $("#tableTyp").val(),


        success: function (data) {






    // additional javascript options for the autocomplete plugin









and at controller


$list= Worker::model()->getAllWorkerList();


              foreach ($list as $value) 


        $arr[] = array(

          'label'=>$value->worker_nickname,  // label for dropdown list

          'value'=>$value->worker_nickname,  // value for input field

          'id'=>$value->worker_code,            // return value from autocomplete



      echo CJSON::encode($arr);


No its wrong… you should use chtml::listdata() then you will get array with id and name… Just search for some example using chtml listdata() method.

Best of luck