AutoComplete inside Controller

Hello, good morning everyone.

I’m doing an app with submitted ajax input/ddl’s and textareas after selecting a radiobutton.

The main problem is i do an "echo" of input textfield however i want it to get autocomplete function (multiple with source from table).

I insert new code in my form by that code, where $attributes equals the name of the tables in the database.

I want to add a multi-autocomplete feature inside this controller function.

Any ideas?


foreach ($attributes as $attrib) {

                $title = ucfirst(str_replace('_',' ',$attrib));

                $id = $tbl . "_" . $attrib;

                $name = $tbl . "[" . $attrib . "]";

                echo '<div class="_form_items newitems">';

                if ($attrib != 'obs') echo GxHtml::tag('label', array('class' => 'required', 'for' => $id), $title.' <span class="required">*</span>', true);

                else echo GxHtml::tag('label', array('for' => $id), $title, true);

                

                if (!in_array($attrib,$ddls)) echo GxHtml::tag('textarea', array('rows'=>3, 'cols'=>50,  'id' => $id, 'name' => $name, 'value' => ''), '', true);

                else

                {

                    echo GxHtml::tag('select', array('id' => $id, 'name' => $name, 'value' => ''), '', false);

                    if ($attrib == 'project_leader') $ddlmodel = User::model()->findAll(array('order' => 'name'));

                    if ($attrib == 'innovation_type') $ddlmodel = ProjectInnovationType::model()->findAll(array('order' => 'name'));

                    foreach ($ddlmodel as $row) {

                        echo GxHtml::tag('option', array('value' => $row->id), GxHtml::encode($row->name), true);

                    }

                    echo GxHtml::tag('select', array('id' => $id, 'name' => $name, 'value' => ''), '', true);

                }

                echo GxHtml::tag('div', array('id' => $id, 'class' => 'errorMessage', 'style' => 'display:none'), '', true);

                echo '</div>';

            }