Skip to content

Commit 56804b2

Browse files
committed
MAGETWO-54785: [GitHub] State/Province field doesn't show as required on the add new address page. #5279
- fixing logic for mandatory labels and error cleanup when switching countries and updating region
1 parent 3be18f3 commit 56804b2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/code/Magento/Checkout/view/frontend/web/js/region-updater.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,13 @@ define([
122122

123123
this.options.form = $(this.options.form);
124124

125-
this.options.form && this.options.form.data('validation') && this.options.form.validation('clearError',
125+
this.options.form && this.options.form.data('validator') && this.options.form.validation('clearError',
126126
this.options.regionListId, this.options.regionInputId, this.options.postcodeId);
127+
128+
// Clean up errors on region & zip fix
129+
$(this.options.regionInputId).removeClass('mage-error').parent().find('[generated]').remove();
130+
$(this.options.regionListId).removeClass('mage-error').parent().find('[generated]').remove();
131+
$(this.options.postcodeId).removeClass('mage-error').parent().find('[generated]').remove();
127132
}
128133
},
129134
/**
@@ -182,11 +187,12 @@ define([
182187
if (!this.options.optionalRegionAllowed) {
183188
regionInput.attr('disabled', 'disabled');
184189
}
190+
requiredLabel.removeClass('required');
191+
regionInput.removeClass('required-entry')
185192
}
186193

187194
regionList.removeClass('required-entry').hide();
188195
regionInput.show();
189-
requiredLabel.removeClass('required');
190196
label.attr('for', regionInput.attr('id'));
191197
}
192198

0 commit comments

Comments
 (0)