Zend Form SetAction Using Named Routes

后端 未结 4 1445
无人及你
无人及你 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:48

    I do not know when it was added, but there is an even simpler solution.

    You can retrieve the form's view object with getView(), which has access to the registered routes.

    //In the form
    $this->setAction($this->getView()->url(array('param1' => 'value1'), 'routeName'));
    

提交回复
热议问题