Skip to content

Commit

Permalink
Ensure from default value only used on file field
Browse files Browse the repository at this point in the history
  • Loading branch information
tr33m4n committed Jan 8, 2023
1 parent 0f7b60e commit dad7891
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/view/adminhtml/web/js/mage/adminhtml/form-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ define([
// define whether the target should show up
var shouldShowUp = true,
idFrom, from, values, isInArray, isNegative, headElement, isInheritCheckboxChecked, target, inputs,
isAnInputOrSelect, currentConfig, rowElement, fromId, radioFrom, targetArray, isChooser;
isAnInputOrSelect, currentConfig, rowElement, fromId, radioFrom, targetArray, isChooser, fromValue;

for (idFrom in valuesFrom) { //eslint-disable-line guard-for-in
from = $(idFrom);

if (from) {
values = valuesFrom[idFrom].values;
isInArray = values.indexOf(from.value || from.defaultValue) !== -1; //eslint-disable-line

fromValue = from.value;
if (from.type === 'file') {
fromValue = from.defaultValue;
}

isInArray = values.indexOf(fromValue) !== -1; //eslint-disable-line
isNegative = valuesFrom[idFrom].negative;

if (!from || isInArray && isNegative || !isInArray && !isNegative) {
Expand Down

0 comments on commit dad7891

Please sign in to comment.