Skip to content

Commit e09b1aa

Browse files
committed
MAGETWO-91465: Once integer is stored for State/Province field, it can not be changed to alphanumeric
1 parent d9fb867 commit e09b1aa

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app/code/Magento/Ui/view/base/web/js/form/element/region.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ define([
5757
registry.get(this.customName, function (input) {
5858
isRegionRequired = !!option['is_region_required'];
5959
input.validation['required-entry'] = isRegionRequired;
60+
input.validation['validate-not-number-first'] = true;
6061
input.required(isRegionRequired);
6162
});
6263
}

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,12 @@ define([
755755
},
756756
$.mage.__('Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.')//eslint-disable-line max-len
757757
],
758+
'validate-not-number-first': [
759+
function (value) {
760+
return utils.isEmptyNoTrim(value) || /^[^0-9].*$$/.test(value);
761+
},
762+
$.mage.__('First character must be letter.')//eslint-disable-line max-len
763+
],
758764
'validate-date': [
759765
function (value, params, additionalParams) {
760766
var test = moment(value, additionalParams.dateFormat);

0 commit comments

Comments
 (0)