From 39049b71c2c09dcd11a63fb22e7b52d154457750 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 7 Sep 2021 11:30:45 +0200 Subject: [PATCH] Fix condition dropdown when the selected question is modified --- www/form/inner.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/www/form/inner.js b/www/form/inner.js index f106c335e..44f7dbd11 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -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