From 0b7510d3887d51910ec18c3bfe57b1f5d26ec2a3 Mon Sep 17 00:00:00 2001 From: marina Date: Wed, 28 May 2025 10:23:44 +0300 Subject: [PATCH] ERP-417 --- erp24/web/js/validate/validateForm.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/erp24/web/js/validate/validateForm.js b/erp24/web/js/validate/validateForm.js index 55ad42d7..5b9ed679 100755 --- a/erp24/web/js/validate/validateForm.js +++ b/erp24/web/js/validate/validateForm.js @@ -57,17 +57,24 @@ $(".form-validate button").click(function (e) { function renderErrors(errors) { var messages = []; + + if (errors['__common']) { + messages = messages.concat(errors['__common']); + } + $.each(errors, function (key, value) { - messages.push(value); - if (key !== '__common') { - var field = yiiform.find('[name="' + key + '"]'); - if (field.length) { - field.closest('.form-group').addClass('has-error'); - field.after('
' + value[0] + '
'); - } + if (key === '__common') return; + + messages = messages.concat(value); + + var field = yiiform.find('[name="' + key + '"]'); + if (field.length) { + field.closest('.form-group').addClass('has-error'); + field.after('
' + value[0] + '
'); } }); - var strOut2 = messages.flat().join(',
'); + + var strOut2 = messages.join(',
'); $('.messages').html(strOut2); } -}); +}); \ No newline at end of file -- 2.39.5