Zend Form SetAction Using Named Routes

后端 未结 4 1447
无人及你
无人及你 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 13:12

    if in my controller action:

    $this->view->form = $form;
    

    I will use view helper url to generate the form action url in my view script ( xxx.phtml):

    $url = $this->url(array('controller'=>'my-controller-name', 
                        'action'=>'my-action-name'), 
                  'my-route-name'
                 );
    
    $this->form->setAction($url);
    
    echo $this->form;
    

提交回复
热议问题