Fix condition dropdown when the selected question is modified

This commit is contained in:
yflory 2021-09-07 11:30:45 +02:00
parent 0af9047b64
commit 39049b71c2
1 changed files with 9 additions and 1 deletions

View File

@ -1516,14 +1516,15 @@ define([
content: obj.q
};
});
var val = drop.getValue();
drop.setOptions(qOptions);
drop.setValue(val);
// Update values dropdown
var $v = $(el).find('.cp-dropdown-container[data-drop="v"]');
if (!$v.length) { return; }
var dropV = $v[0] && $v[0].dropdown;
if (!dropV) { return; }
var val = drop.getValue();
var res, type;
values.some(function (obj) {
if (String(obj.uid) === String(val)) {
@ -1543,7 +1544,14 @@ define([
content: str
};
});
var valV = dropV.getValue();
dropV.setOptions(vOptions);
if (valV && res.indexOf(valV) === -1) {
dropV.setValue('', Messages.form_condition_v);
dropV.onChange.fire();
dropV.find('button').removeClass('btn-default')
.addClass('btn-secondary');
}
});
} else {
// We don't have invalid condition but we may have incomplete