From ee9b3a4e9482222da41dfb884e6185d6180147f1 Mon Sep 17 00:00:00 2001 From: Oldřich Jedlička Date: Tue, 20 Oct 2020 20:15:30 +0200 Subject: luci-base: Fix using isActive in widget-change notification. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `onchange` notification handler is called too early to be able to evaluate other widget's `isActive()` status. Solve this by changing order of event handling - first register/execute `map.checkDepends` and then `onchange`. Fixes: openwrt/luci#4516. Signed-off-by: Oldřich Jedlička --- modules/luci-base/htdocs/luci-static/resources/form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 568a4abb6..1d705e3bf 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -3351,10 +3351,10 @@ var CBIValue = CBIAbstractValue.extend(/** @lends LuCI.form.Value.prototype */ { optionEl.classList.add('hidden'); optionEl.addEventListener('widget-change', - L.bind(this.handleValueChange, this, section_id, {})); + L.bind(this.map.checkDepends, this.map)); optionEl.addEventListener('widget-change', - L.bind(this.map.checkDepends, this.map)); + L.bind(this.handleValueChange, this, section_id, {})); dom.bindClassInstance(optionEl, this); -- cgit v1.2.3