[BUGFIX] EXT:form - mandatoryValidationMessages unset after submit 19/48619/2
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Wed, 15 Jun 2016 09:11:22 +0000 (11:11 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 20 Jun 2016 21:00:29 +0000 (23:00 +0200)
Build the validation rules within the initializeShowAction

Resolves: #73218
Releases: master, 7.6
Change-Id: I1b441db52da57b8db6a574f87a1600b5332154df
Reviewed-on: https://review.typo3.org/48619
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/form/Classes/Controller/FrontendController.php

index 43887db..4c769d3 100755 (executable)
@@ -120,16 +120,11 @@ class FrontendController extends ActionController
      */
     protected function initializeShowAction()
     {
-        // set validation errors
         $validationResults = $this->request->getOriginalRequestMappingResults()->forProperty('model');
-        if (!$validationResults->hasErrors()) {
-            // If there are errors, the rules already build
-                // but if there are errors, we need to build the rules here,
-                // because of the mandatory message rendering
-            $this->validationBuilder->buildRules();
-            return;
+        $this->validationBuilder->buildRules();
+        if ($validationResults->hasErrors()) {
+            $this->formBuilder->setValidationErrors($validationResults);
         }
-        $this->formBuilder->setValidationErrors($validationResults);
     }
 
     /**