Skip to content

Commit 98c567a

Browse files
committed
Region text field is not reset when country dropdown is changed
1 parent 71432ae commit 98c567a

File tree

1 file changed

+9
-6
lines changed
  • app/code/Magento/Customer/view/adminhtml/web/js/form/element

1 file changed

+9
-6
lines changed

app/code/Magento/Customer/view/adminhtml/web/js/form/element/region.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ define([
2525
countryId = this.source.data.country_id,
2626
hasRegionList = indexedOptionsArray.some(option => option.country_id === countryId);
2727

28-
this.source.set(
29-
this.regionScope,
30-
hasRegionList
31-
? parseFloat(value) ? this.indexedOptions?.[value]?.label || '' : ''
32-
: this.source.data?.region || ''
33-
);
28+
// Clear the region field when the country changes
29+
this.source.set(this.regionScope, '');
30+
31+
if (hasRegionList) {
32+
this.source.set(
33+
this.regionScope,
34+
parseFloat(value) ? this.indexedOptions?.[value]?.label || '' : ''
35+
);
36+
}
3437
}
3538
});
3639
});

0 commit comments

Comments
 (0)