[TYPO3-mvc] Forwarding action without loosing request parameters
Jochen Rau
jochen.rau at typoplanet.de
Sat Oct 31 08:46:13 CET 2009
Hi Thomas.
> The process looks like the following:
> 1. Index action gets called, showing a form in index.html
> 2. Form gets submitted with the action "calculate"
> 3. Variable gets assigned, forwarding to index action
> 4. {address} is not available in the view/template
>
> Is there a way to either forward the {address} to the index action,
> or a way to use the same template/view for the calculate action also?
Maybe you would like to invoke redirect() instead of forward(). This
will persist your calculated address by finalizing the actual request
and sending a new one.
class MyController extends Tx_Extbase_MVC_Controller_ActionController {
/**
* The main action
* @param string $newAddress
* @dontvalidate $newAddress
*/
public function indexAction($newAddress = NULL) {
// Display Form
}
/**
* The calculate action
*
* @param string $address
* @validate $address Alphanumeric
*/
public function calculateAction($address) {
$this->view->assign('address', $address);
$this->redirect('index');
}
}
The methods redirect() and forward() are defined in the ActionController
of Extbase.
Regards
Jochen
--
Every nit picked is a bug fixed
More information about the TYPO3-project-typo3v4mvc
mailing list