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:26:33 +0000 (19:26 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/form.js

index b31dac7145918f34e6124c16e5c39aaf2775b997..9c59c650a38eb63cf18fc7d74d022406b8b2519d 100644 (file)
@@ -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)