Skip to content

Commit

Permalink
MAGETWO-54785: [GitHub] State/Province field doesn't show as required…
Browse files Browse the repository at this point in the history
… on the add new address page. #5279

- fixing logic for mandatory labels and error cleanup when switching countries and updating region
  • Loading branch information
cpartica committed Jul 1, 2016
1 parent 3be18f3 commit 56804b2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/code/Magento/Checkout/view/frontend/web/js/region-updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,13 @@ define([

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

this.options.form && this.options.form.data('validation') && this.options.form.validation('clearError',
this.options.form && this.options.form.data('validator') && this.options.form.validation('clearError',
this.options.regionListId, this.options.regionInputId, this.options.postcodeId);

// Clean up errors on region & zip fix
$(this.options.regionInputId).removeClass('mage-error').parent().find('[generated]').remove();
$(this.options.regionListId).removeClass('mage-error').parent().find('[generated]').remove();
$(this.options.postcodeId).removeClass('mage-error').parent().find('[generated]').remove();
}
},
/**
Expand Down Expand Up @@ -182,11 +187,12 @@ define([
if (!this.options.optionalRegionAllowed) {
regionInput.attr('disabled', 'disabled');
}
requiredLabel.removeClass('required');
regionInput.removeClass('required-entry')
}

regionList.removeClass('required-entry').hide();
regionInput.show();
requiredLabel.removeClass('required');
label.attr('for', regionInput.attr('id'));
}

Expand Down

0 comments on commit 56804b2

Please sign in to comment.