luci-base: form.js: pass section_id to Button onclick handler

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c1aeb300f6)
This commit is contained in:
Jo-Philipp Wich 2020-02-12 22:21:29 +01:00
parent 405f5e837f
commit 1fdef8cb68

View file

@ -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)