From 4f2fa65f990edc196ca4314d6e0a5dbd832fbca6 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 1 Mar 2017 12:31:08 +0200 Subject: [PATCH] MAGETWO-63200: State field is not required on checkout even though it is configured to be --- .../Magento/Ui/view/base/web/js/form/element/region.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/region.js b/app/code/Magento/Ui/view/base/web/js/form/element/region.js index 4b12b72a8fc70..3fabe843f73e2 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/region.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/region.js @@ -24,6 +24,7 @@ define([ update: function (value) { var country = registry.get(this.parentName + '.' + 'country_id'), options = country.indexedOptions, + isRegionRequired, option; if (!value) { @@ -43,6 +44,14 @@ define([ this.validation['required-entry'] = true; } + if (option && !this.options().length) { + registry.get(this.customName, function (input) { + isRegionRequired = !!option['is_region_required']; + input.validation['required-entry'] = isRegionRequired; + input.required(isRegionRequired); + }); + } + this.required(!!option['is_region_required']); } },