i want to redirect from action a to action b in the same module. Action b requires csrf token to execute, and i need to pass it a few parameters as well.
action a:
public function executeA(sfWebRequest $request){
//... do stuff
$this->redirect('module/b?id='.$something->getId());
}
action b:
public function executeB(sfWebRequest $request){
$request->checkCSRFProtection(); //morte
$something_id = $request->getParameter('id');
//... do stuff
}
the action b executes, only if clicked on anchor created by link_to('module/b?id='.$something.getId() , array('method' => 'post')) or any other method, because it sends csrf token with the request.
i tried $this->forward() and $this->redirect() methods, and tried to add 'method' => 'post' to redirect params like in link_to() , but nothing works, and i cant find anything about it on the web either. API documentation says noting about it. all i get is
500 | Internal Server Error | sfValidatorErrorSchema
_csrf_token [Required.]
error. it fails on the line marked //morte. please, does anyone know, how to do this properly, and also in cases that i want to redirect to other module?
Ok this more clear now.
The fact is the
_csrf_tokenisn’t redirect to the other action, I mean, you didn’t re-add it in the query.Try: