symfony1 - Symfony - Redirect to action with form values filled in -


how can redirect action, , form fields filled in on new action?

i have action , want call redirect() like:

$this->redirect('foo/search?search[last_name]='.$this->form->getvalue('last_name')); 

which should redirect search action, , form in action should last_name parameter filled in. action has code so:

public function executesearch(sfwebrequest $request) {    $this->form = new searchform();    $submission = $request->getparameter($this->form->getname());    ...do stuff $submission... 

the searchform has name format 'search[%s]'.

nothing i've tried parameter redirect() has worked. search[] parameters messed in way , not populate form.

i try symfony generate url based on route , parameters:

@search = route search action in routing.yml  $parameters = array of parameters want pass  $url = $this->generateurl('search', $parameters); $this->redirect($url); 

the array of parameters should take following format...

'search[something1]' => 'value1' 'search[something2]' => 'value2' 

... url takes them as:

?search[something1]=value1&search[something2]=value2 

you should able use...

$this->form->bind($request->getparameter('search')); (for binding) 

... , even...

$this->form->setdefaults($request->getparameter('search')); (for populating template) 

hope helps or @ least gives ideas.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -