diff options
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 1c1c9c8c91..a417616d2f 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -1585,28 +1585,29 @@ var CBIButtonValue = CBIValue.extend({ __name__: 'CBI.ButtonValue', renderWidget: function(section_id, option_index, cfgvalue) { - var value = (cfgvalue != null) ? cfgvalue : this.default; + var value = (cfgvalue != null) ? cfgvalue : this.default, + hiddenEl = new ui.Hiddenfield(value, { id: this.cbid(section_id) }), + outputEl = E('div'); if (value !== false) - return E([ - E('input', { - 'type': 'hidden', - 'id': this.cbid(section_id) - }), + L.dom.content(outputEl, [ E('input', { 'class': 'cbi-button cbi-button-%s'.format(this.inputstyle || 'button'), - 'type': 'submit', - //'id': this.cbid(section_id), - //'name': this.cbid(section_id), + 'type': 'button', 'value': this.inputtitle || this.title, - 'click': L.bind(function(ev) { + 'click': L.bind(this.onclick || function(ev) { ev.target.previousElementSibling.value = ev.target.value; this.map.save(); }, this) }) ]); else - return document.createTextNode(' - '); + L.dom.content(outputEl, ' - '); + + return E([ + outputEl, + hiddenEl.render() + ]); } }); |