projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c0612e8
)
luci-base: cbi.js: add cbi_submit() helper
author
Jo-Philipp Wich
<jo@mein.io>
Wed, 18 Jul 2018 09:23:50 +0000
(11:23 +0200)
committer
Jo-Philipp Wich
<jo@mein.io>
Fri, 20 Jul 2018 05:56:12 +0000
(07:56 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit
7b43e81c9b88df9623cfa22a79627558787378ea
)
modules/luci-base/htdocs/luci-static/resources/cbi.js
patch
|
blob
|
history
diff --git
a/modules/luci-base/htdocs/luci-static/resources/cbi.js
b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index ddbff834182210021a5a8ee47e2dd4d036a6e924..89dfac9e46a87e6611475498ce1e541b2490312e 100644
(file)
--- a/
modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/
modules/luci-base/htdocs/luci-static/resources/cbi.js
@@
-1306,6
+1306,28
@@
function cbi_tag_last(container)
}
}
+function cbi_submit(elem, name, value, action)
+{
+ var form = elem.form || findParent(elem, 'form');
+
+ if (!form)
+ return false;
+
+ if (action)
+ form.action = action;
+
+ if (name) {
+ var hidden = form.querySelector('input[type="hidden"][name="%s"]'.format(name)) ||
+ E('input', { type: 'hidden', name: name });
+
+ hidden.value = value || '1';
+ form.appendChild(hidden);
+ }
+
+ form.submit();
+ return true;
+}
+
String.prototype.format = function()
{
if (!RegExp)