[BUGFIX] Prevent validation from altering the field value 67/48067/4
authorNikola Stojiljkovic <nikola.stojiljkovic@essentialdots.com>
Tue, 10 May 2016 14:27:26 +0000 (17:27 +0300)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Tue, 10 May 2016 15:30:48 +0000 (17:30 +0200)
Resolves: #76124
Releases: master
Change-Id: Ib53e24c17c0f662db06f4db039c39c0e9eeb4b30
Reviewed-on: https://review.typo3.org/48067
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js

index 89d1441..e925172 100644 (file)
@@ -238,17 +238,20 @@ define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function ($, FormEngine) {
         */
        FormEngineValidation.validateField = function($field, value) {
                value = value || $field.val();
-               if (!$.isArray(value)) {
-                       value = FormEngineValidation.ltrim(value);
-               }
 
                var rules = $field.data('formengine-validation-rules');
                var markParent = false;
                var selected = 0;
+               // keep the original value, validateField should not alter it
                var returnValue = value;
                var $relatedField;
                var minItems;
                var maxItems;
+
+               if (!$.isArray(value)) {
+                       value = FormEngineValidation.ltrim(value);
+               }
+
                $.each(rules, function(k, rule) {
                        switch (rule.type) {
                                case 'required':