From 447aac06a052d8333ee26d6c0115591e712ef982 Mon Sep 17 00:00:00 2001 From: trr Date: Fri, 14 Jun 2019 17:35:28 +0200 Subject: [PATCH] hide or show the select for regions instead of enabling/disabling in customer registration --- .../view/frontend/web/js/region-updater.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index cf2a59cdba427..80481826260ff 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -157,7 +157,7 @@ define([ regionInput = $(this.options.regionInputId), postcode = $(this.options.postcodeId), label = regionList.parent().siblings('label'), - requiredLabel = regionList.parents('div.field'); + container = regionList.parents('div.field'); this._clearError(); this._checkRegionRequired(country); @@ -181,15 +181,16 @@ define([ if (this.options.isRegionRequired) { regionList.addClass('required-entry').removeAttr('disabled'); - requiredLabel.addClass('required'); + container.addClass('required').show(); } else { regionList.removeClass('required-entry validate-select').removeAttr('data-validate'); - requiredLabel.removeClass('required'); + container.removeClass('required'); if (!this.options.optionalRegionAllowed) { //eslint-disable-line max-depth - regionList.attr('disabled', 'disabled'); + regionList.hide(); + container.hide(); } else { - regionList.removeAttr('disabled'); + regionList.show(); } } @@ -201,12 +202,13 @@ define([ if (this.options.isRegionRequired) { regionInput.addClass('required-entry').removeAttr('disabled'); - requiredLabel.addClass('required'); + container.addClass('required').show(); } else { if (!this.options.optionalRegionAllowed) { //eslint-disable-line max-depth regionInput.attr('disabled', 'disabled'); + container.hide(); } - requiredLabel.removeClass('required'); + container.removeClass('required'); regionInput.removeClass('required-entry'); }