Zend Form SetAction Using Named Routes

后端 未结 4 1446
无人及你
无人及你 2020-12-31 12:45

I have a form that I am trying to set the action for. I want to declare the action inside my form file (which extends Zend_Form) instead of in a controller or view, using a

4条回答
  •  鱼传尺愫
    2020-12-31 12:55

    Nowadays you can access the Zend_View object via getView() method on Zend_Form classes:

    // init your form    
    public function init()
    {
        $view = $this->getView();
        $url = $view->url(array('module'=>'login','action'=>'login'));
        $this->setAction($url);
        ...
    }
    

    Might this help on ZF 1.8+

提交回复
热议问题