[BUGFIX] EXT:form - Setting a custom action does not work 54/43754/7
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Wed, 7 Oct 2015 16:01:32 +0000 (18:01 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Oct 2015 16:27:02 +0000 (18:27 +0200)
Use the f:form pageUid argument if an "action" property is set in the
form configuration.

Resolves: #70280
Releases: master
Change-Id: Ic32a52d8ef3062aa5b7d230dc7a57627c80c4e25
Reviewed-on: http://review.typo3.org/43754
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/form/Classes/Controller/FrontendController.php
typo3/sysext/form/Classes/Domain/Builder/FormBuilder.php

index 2583bb0..fb6598e 100755 (executable)
@@ -172,14 +172,6 @@ class FrontendController extends ActionController {
                        $this->controllerContext->setValidationElement($incomingData);
                }
                $form = $this->formBuilder->buildModel();
-               if (
-                       $this->typoscript['confirmation']
-                       && (int)$this->typoscript['confirmation'] == 1
-               ) {
-                       $form->setAdditionalArgument('action', 'confirmation');
-               } else {
-                       $form->setAdditionalArgument('action', 'process');
-               }
                $this->view->assign('model', $form);
        }
 
index ab1ef00..1f1a14a 100644 (file)
@@ -454,6 +454,26 @@ class FormBuilder {
                $additionalArguments['prefix'] = $this->configuration->getPrefix();
                $element->setAdditionalArguments($additionalArguments);
                $this->handleIncomingValues($element, $userConfiguredElementTypoScript);
+
+               if (
+                       $element->getElementType() === 'FORM'
+                       && $this->getControllerAction() === 'show'
+               ) {
+                       if (empty($element->getHtmlAttribute('action'))) {
+                               if (
+                                       $element->getAdditionalArgument('confirmation')
+                                       && (int)$element->getAdditionalArgument('confirmation') === 1
+                               ) {
+                                       $element->setAdditionalArgument('action', 'confirmation');
+                               } else {
+                                       $element->setAdditionalArgument('action', 'process');
+                               }
+                       } else {
+                               $element->setAdditionalArgument('pageUid', $element->getHtmlAttribute('action'));
+                               $element->setAdditionalArgument('action', NULL);
+                       }
+               }
+
                // needed if confirmation page is enabled
                if (
                        $this->sessionUtility->getSessionData($element->getName())