]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-417
authormarina <m.zozirova@gmail.com>
Wed, 28 May 2025 12:19:46 +0000 (15:19 +0300)
committermarina <m.zozirova@gmail.com>
Wed, 28 May 2025 12:19:46 +0000 (15:19 +0300)
erp24/web/js/validate/validateForm.js

index f9ca9eeabb1b4fb3bf78d13826b4c77ab4ba2576..0c98f89417340b44a186b1a5ed07e00e26ccb885 100755 (executable)
@@ -47,13 +47,13 @@ $(".form-validate button").click(function (e) {
             if (Object.keys(errors).length > 0) {
                 renderErrors(errors);
                 let allErrors = [];
-                $.each(errors, function(key, val) {
-                    if (Array.isArray(val)) {
-                        allErrors = allErrors.concat(val);
+                for (const key in errors) {
+                    if (Array.isArray(errors[key])) {
+                        allErrors = allErrors.concat(errors[key]);
                     } else {
-                        allErrors.push(val);
+                        allErrors.push(errors[key]);
                     }
-                });
+                }
                 alert(allErrors.join('\n'));
             } else {
                 yiiform.off('submit');
@@ -88,4 +88,4 @@ $(".form-validate button").click(function (e) {
         var strOut2 = messages.join(', <br>');
         $('.messages').html(strOut2);
     }
-});
\ No newline at end of file
+});