Skip to content

Commit 9671ad8

Browse files
author
Cristian Partica
committed
MAGETWO-35027: FPT Attribute is displayed as required on "create Product" Backend page for countries with states
- fixed with a js class attribute temporary save and restore for the FPT case
1 parent 38f9431 commit 9671ad8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

app/code/Magento/Weee/view/adminhtml/web/js/fpt-attribute.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ define([
2828
},
2929
_initOptionItem: function () {
3030
var widget = this;
31+
var originalElementClass=$(widget.element).attr('class');
3132

3233
this._on({
3334
//Add new tax item
@@ -55,6 +56,10 @@ define([
5556
if (data.state) {
5657
parentElement.find('[data-role="select-state"]').val(data.state);
5758
}
59+
//fpt is a field with multiple sub-fields so we restore it's required status
60+
var currentElementClass=$(widget.element).attr('class');
61+
if (!originalElementClass.match(/required/) && currentElementClass.match(/required/))
62+
$(widget.element).attr('class',originalElementClass);
5863
}
5964
});
6065

lib/web/mage/adminhtml/form.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ RegionUpdater.prototype = {
150150
}
151151
}
152152

153+
//compute the need for the required fields
153154
if (!regionRequired || !currentElement.visible()) {
154155
if (field.hasClassName('required')) {
155156
field.removeClassName('required');

0 commit comments

Comments
 (0)