From b37aaf681b6b484a73fe7e5c7f6d7bb6ca15fd92 Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Thu, 26 Nov 2015 19:03:12 +0200 Subject: [PATCH] MAGETWO-46011: The empty mandatory fields are not displayed for a user, after clicking on Save button --- .../base/web/js/form/components/tab_group.js | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js b/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js index d22b911402457..bf1dffb9ebeea 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js @@ -57,20 +57,19 @@ define([ * @param {Object} elem */ validate: function (elem) { - var source = this.source, - result = elem.delegate('validate'), - invalid = false; + var result = elem.delegate('validate'), + invalid; - _.some(result, function (item) { - return !item.valid && (invalid = item.target); + invalid = _.find(result, function (item) { + return !item.valid; }); - if (invalid && !source.get('params.invalid')) { - source.set('params.invalid', true); - + if (invalid) { elem.activate(); - invalid.focused(true); + invalid.target.focused(true); } + + return invalid; }, /** @@ -78,13 +77,9 @@ define([ * of instance for each element. */ onValidate: function () { - var elems; - - elems = this.elems.sortBy(function (elem) { + this.elems.sortBy(function (elem) { return !elem.active(); - }); - - elems.forEach(this.validate, this); + }).some(this.validate, this); } }); });