From 58447640eb4704ce5bed612f84cb86b84afa17fa Mon Sep 17 00:00:00 2001 From: Helge Mader Date: Fri, 12 Mar 2021 10:48:29 +0100 Subject: luci-base: prevent empty field for adding new entry Signed-off-by: Florian Eckert --- modules/luci-base/htdocs/luci-static/resources/cbi.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules/luci-base/htdocs/luci-static/resources') diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index b66fe684a5..d6020e9d58 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -367,6 +367,17 @@ function cbi_validate_form(form, errmsg) return true; } +function cbi_validate_named_section_add(input) +{ + var button = input.parentNode.parentNode.querySelector('.cbi-button-add'); + if (input.value !== '') { + button.disabled = false; + } + else { + button.disabled = true; + } +} + function cbi_validate_reset(form) { window.setTimeout( -- cgit v1.2.3