From c1aeb300f6976086e48dd90aac1504f38b73cdf9 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 --- 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 b31dac714..9c59c650a 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -1894,7 +1894,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