summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index ddbff8341..89dfac9e4 100644
--- 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)