Yii Framework Forum: AutoComplete inside Controller - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

AutoComplete inside Controller

#1 User is offline   chumbx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 26-January 12

Posted 23 February 2012 - 04:17 AM

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>';
            }

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users