php - Zend Form getValues() doesn't work -


i'm trying create simple form zend, need use form in part, create default form in controller modify occurrence private function. have 2 problems:

  1. the form getvalues() doesn't take value of text element.
  2. i put render @ end of form action, doesn't render right page.

the form consists of text field , sumbit button

here code of controller:

that customize form

private function getsearchform($action = '', $name, $type, $placeholder) {     $urlhelper = $this->_helper->gethelper('url');     $this->_searchform = new application_form_admin_search_search();     $this->_searchform->setname($name);     $text = $this->_searchform->getelement('ricerca');     $text->setlabel('ricerca '.$type);     $text->setname($type);     $text->setattrib('placeholder', $placeholder);     $this->_searchform->setaction($urlhelper->url(array(         'controller' => 'admin',         'action' => $action),         'default'     ));     return $this->_searchform; } 

there actions:

public function pneumaticoaction() {     $this->_searchform = $this->getsearchform('pneumaticosearch', 'search', 'pneumatico', 'ricerca per: modello, marchio o codice');     $this->view->searchform = $this->_searchform; }  public function pneumaticosearchaction() {     if (!$this->getrequest()->ispost()) {         $this->_helper->redirector('index', 'public');     }     $form=$this->_searchform;     if (!$form->isvalid($this->getrequest()->getpost())) {         $this->render('pneumatico');     }     $values = $form->getvalues();     $this->view->assign(array(         "pneumatici" => $this->_modeladmin->searchpneumatici($values['pneumatico'])     ));     $this->render('pneumatico'); } 

first question, whenever routed pneumaticosearch action, not set $this->_searchform have as:

$form=$this->_searchform; 

should this:

$form = $this->getsearchform('pneumaticosearch', 'search', 'pneumatico', 'ricerca per: modello, marchio o codice'); 

and second question. when run render, similar pass $this->view parameters .phtml. don't see view files, guess need set view first:

$this->view->searchform = $form 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -