From: marina Date: Wed, 28 May 2025 07:23:44 +0000 (+0300) Subject: ERP-417 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=0b7510d3887d51910ec18c3bfe57b1f5d26ec2a3;p=erp24_rep%2Fyii-erp24%2F.git ERP-417 --- 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