addElement('static', 'dump', array('label' => 'SUBMITTED VALUES')); $this->addElement('autocomplete', 'state', array('label' => 'State (dataUrl: ajax)')); $this->state->setDataUrl(Qs_Request::url(array('action' => 'autocompleteState'))); if (null !== ($state = $this->_getData('state'))) { $table = new Qs_Db_Table('DState'); if (null !== ($stateTitle = $table->search($state, 'title'))) { $this->state->setTitle($stateTitle); } } $languageTable = new Qs_Db_Table('DLanguage'); $dataArray = $languageTable->get4Select(array('name', 'title', 'icon')); $this->addElement( 'autocomplete', 'languages', array( 'label' => 'Languages (dataArray: data with additional fields)', 'dataArray' => $dataArray, 'renderItem' => 'renderLangItem' ) ); $this->addElement( 'autocomplete', 'number', array( 'label' => 'Numbers (multiOptions: key => value pairs)', 'multiOptions' => array( 'i1' => 'One', 'i2' => 'Two', 'i3' => 'Three', 'i4' => 'Four', 'i5' => 'Five', 'i6' => 'Six', 'i7' => 'Seven', ) ) ); $this->addElement( 'autocomplete', 'menuItem', array( 'label' => 'Menu Items (dataCallback: JavaScript Callback)', 'dataCallback' => 'getMenuItems', ) ); /** @var $doc Qs_Doc */ $doc = Zend_Registry::get('doc'); $doc->addInlineScript('getMenuItems', file_get_contents(str_replace('.php', '.js', __FILE__))); return $this; } }