If you use the form at multiple places, you could consider making it into a view helper. The helper is easy to place inside your views and inside the helper you could initialize the form and set its action url. Regards, Jurian -- Jurian Sluiman Soflomo.com
Op Wednesday 21 October 2009 15:47:45 schreef Саша Стаменковић: > Why I want to do this in the form is, I want to set url on one place. Form > will be rendered in many views, I don't want each of them set separate url, > want to do it in one place, in the form init. > > Regards, > Saša Stamenković > > On Wed, Oct 21, 2009 at 3:22 PM, Kyle Spraggs <the...@spiffyjr.me> wrote: > > umpirsky wrote: > > > Hi. > > > > > > I wonder, if you want to use url helper for all urls in your app, you > > > can access it from view with $this->url(). from controller with > > > $this->wiew->url()... > > > > > > But when you want for example to use it to set action of a form in form > > > init() method, do you access it through front controller or bootstrap > > > or you set action explicitly in the view script? > > > What is the right way to go? > > > > > > Regards, > > > Sasa Stamenkovic. > > > > You can do that easily using the form view helper and the URL of the > > calling > > page so doing so from the init() method isn't required. For example, > > > > indexAction() > > { > > $this->view->form = new Default_Form_MyForm(); > > } > > > > > > index.phtml > > <?=$this->form->setAction($this->url());?> > > > > You could probably do it in the form using the helper broker but I've > > never had a need to do so. > > -- > > View this message in context: > > http://www.nabble.com/url-helper-available-all-over-your-app-tp25992262p2 > >5992433.html Sent from the Zend Framework mailing list archive at > > Nabble.com.
signature.asc
Description: This is a digitally signed message part.