[TYPO3-mvc] Forwarding action without loosing request parameters

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Wed Nov 4 19:01:56 CET 2009


Any ideas? I'm stuck with this - does anybody know
where the problem is? Am I doing something wrong?

Thanks a lot!

Thomas "Thasmo" Deinhamer schrieb:
> That's all a bit weird.
> 
> I changed the method to 'redirect()', but now the following accours:
> 
> If I use method="post" in the <f:form> tag, it will redirect me to 
> http://my-domain.tld//<title>.<id>.<type>.html?&tx_ext_plugin[action]=index&tx_ext_plugin[controller]=PluginController&cHash=<hash> 
> 
> 
> The weird is, that the two "//" won't be recognized by TYPO3 and the
> homepage will be shown with no error-handling page defined in the 
> install-tool. (Also 'index' as controller is wrong, but should be 
> overwritten with the POST variable anyways.)
> 
> If I use method="get" in the <f:form> tag, the form action attribute of 
> http://my-domain.tld/<title>.<id>.<type>.html?&tx_ext_plugin[action]=calculate&tx_ext_plugin[controller]=PluginController&cHash=<hash> 
> 
> won't be used as the destination uri, further more ONLY the valuepairs 
> which are in the form will be sent as querystring, which resulst in:
> http://my-domain.tld//<title>.<id>.<type>.html?tx_ext_plugin[__referrer][extensionName]=ExtName&tx_ext_plugin[__referrer][controllerName]=PluginContro... 
> which completely skips the dstination controller 'calculate' which was 
> set in the action or the form.
> 
> I'm using Firefox 3.5.4.
> 
> Any ideas? Is this a bug?
> 
> Thanks!
> 
> 
> Jochen Rau schrieb:
>> 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
>>
>>


More information about the TYPO3-project-typo3v4mvc mailing list