From: Oldřich Jedlička Date: Tue, 20 Oct 2020 18:15:30 +0000 (+0200) Subject: luci-base: Fix using isActive in widget-change notification. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=refs%2Fpull%2F4531%2Fhead;p=project%2Fluci.git luci-base: Fix using isActive in widget-change notification. 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 --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 568a4abb6a..1d705e3bf2 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);