From: Jo-Philipp Wich Date: Wed, 12 Feb 2020 21:21:29 +0000 (+0100) Subject: luci-base: form.js: pass section_id to Button onclick handler X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c1aeb300f6976086e48dd90aac1504f38b73cdf9;p=oweals%2Fluci.git luci-base: form.js: pass section_id to Button onclick handler Signed-off-by: Jo-Philipp Wich --- 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)