luci-base: form.js: pass section_id to Button onclick handler
authorJo-Philipp Wich <jo@mein.io>
Wed, 12 Feb 2020 21:21:29 +0000 (22:21 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 13 Feb 2020 18:31:34 +0000 (19:31 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c1aeb300f6976086e48dd90aac1504f38b73cdf9)

modules/luci-base/htdocs/luci-static/resources/form.js

index aecb6227c8290216156cc1e3584ee48fae587024..b9ba977cc7c31388213d2fc258f2cd6555e007b9 100644 (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)