From 1fdef8cb685197984375121720c1129e0bbdb95f Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 12 Feb 2020 22:21:29 +0100 Subject: [PATCH] luci-base: form.js: pass section_id to Button onclick handler Signed-off-by: Jo-Philipp Wich (cherry picked from commit c1aeb300f6976086e48dd90aac1504f38b73cdf9) --- modules/luci-base/htdocs/luci-static/resources/form.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index aecb6227c..b9ba977cc 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -1890,7 +1890,10 @@ var CBIButtonValue = CBIValue.extend({ L.dom.content(outputEl, [ E('button', { 'class': 'cbi-button cbi-button-%s'.format(this.inputstyle || 'button'), - 'click': L.ui.createHandlerFn(this, this.onclick || function(ev) { + 'click': L.ui.createHandlerFn(this, function(section_id, ev) { + if (this.onclick) + return this.onclick(ev, section_id); + ev.currentTarget.parentNode.nextElementSibling.value = value; return this.map.save(); }, section_id) -- 2.25.1