Skip to content

Commit

Permalink
ENGCOM-5409: hide or show the select for regions instead of enabling/…
Browse files Browse the repository at this point in the history
…disabling in customer registration #23272
  • Loading branch information
sivaschenko authored Jul 8, 2019
2 parents 44b455c + 021ead5 commit d47bbfb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/code/Magento/Checkout/view/frontend/web/js/region-updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
}

Expand All @@ -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');
}

Expand Down

0 comments on commit d47bbfb

Please sign in to comment.