summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-10-10 08:28:15 +0200
committerJo-Philipp Wich <jo@mein.io>2018-10-10 08:29:02 +0200
commit0b6ae96f2daab39547affb77fc41a6040a663a2f (patch)
treef2b2717b478810ed7fe99f6c7c9cba277fa6c5a1
parentc126c7349dccbc516cda23dacd4f14a381c8aa1b (diff)
luci-base: cbi.js: recognize invalid input in dropdown create field
This is required to allow for validating the create field values in later commits. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index fcfc50694..e5acdbcd7 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -2062,8 +2062,12 @@ function cbi_dropdown_init(sb) {
create.addEventListener('keydown', function(ev) {
switch (ev.keyCode) {
case 13:
- sbox.createItems(sb, this.value);
ev.preventDefault();
+
+ if (this.classList.contains('cbi-input-invalid'))
+ return;
+
+ sbox.createItems(sb, this.value);
this.value = '';
this.blur();
break;