From: Helge Mader Date: Fri, 12 Mar 2021 09:48:29 +0000 (+0100) Subject: luci-base: prevent empty field for adding new entry X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=58447640eb4704ce5bed612f84cb86b84afa17fa;p=project%2Fluci.git luci-base: prevent empty field for adding new entry Signed-off-by: Florian Eckert --- 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( diff --git a/modules/luci-compat/luasrc/view/cbi/tblsection.htm b/modules/luci-compat/luasrc/view/cbi/tblsection.htm index 048eb22c41..1cba660884 100644 --- a/modules/luci-compat/luasrc/view/cbi/tblsection.htm +++ b/modules/luci-compat/luasrc/view/cbi/tblsection.htm @@ -192,9 +192,9 @@ end
<%:Invalid%>
<%- end %>
- +
- + <% end %> <%- end %> diff --git a/modules/luci-compat/luasrc/view/cbi/tsection.htm b/modules/luci-compat/luasrc/view/cbi/tsection.htm index 45e51cc69f..703e1ff328 100644 --- a/modules/luci-compat/luasrc/view/cbi/tsection.htm +++ b/modules/luci-compat/luasrc/view/cbi/tsection.htm @@ -42,9 +42,9 @@
<%:Invalid%>
<%- end %>
- +
- + <%- end %> <%- end %>