[TASK] Implement stop functionality to additionalJS_submit 43/43743/5
authorFrank Nägler <frank.naegler@typo3.org>
Fri, 2 Oct 2015 14:41:24 +0000 (16:41 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 23 Oct 2015 08:27:17 +0000 (10:27 +0200)
Using the hook in JS is not possible to stop the
submission of the form engine. A stop parameter
solves the problem.

Resolves: #17626
Releases: master
Change-Id: Ibcb9a5119a4827bb0ce03971c792a01eeafe3e6c
Reviewed-on: https://review.typo3.org/43743
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js

index 8be306f..c2ab5b1 100644 (file)
@@ -194,7 +194,8 @@ var TBE_EDITOR = {
         */
        checkSubmit: function(sendAlert) {
                var funcIndex, funcMax, funcRes;
-               var OK=1;
+               var OK = 1;
+               var STOP = 0;
 
                // $this->additionalJS_submit:
                if (TBE_EDITOR.actionChecks && TBE_EDITOR.actionChecks.submit) {
@@ -205,7 +206,12 @@ var TBE_EDITOR = {
                        }
                }
 
-               if(!OK) {
+               if (STOP) {
+                       // return false immediately, if the code in additionalJS_submit set STOP variable.
+                       return false;
+               }
+
+               if (!OK) {
                        if (!confirm(unescape("SYSTEM ERROR: One or more Rich Text Editors on the page could not be contacted. This IS an error, although it should not be regular.\nYou can save the form now by pressing OK, but you will loose the Rich Text Editor content if you do.\n\nPlease report the error to your administrator if it persists."))) {
                                return false;
                        } else {
@@ -220,7 +226,7 @@ var TBE_EDITOR = {
                if (OK || sendAlert==-1) {
                        return true;
                } else {
-                       if(sendAlert) alert(TBE_EDITOR.labels.fieldsMissing);
+                       if (sendAlert) alert(TBE_EDITOR.labels.fieldsMissing);
                        return false;
                }
        },