diff options
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/cbi.js | 11 | ||||
-rw-r--r-- | modules/luci-compat/luasrc/view/cbi/tblsection.htm | 4 | ||||
-rw-r--r-- | modules/luci-compat/luasrc/view/cbi/tsection.htm | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 513256e4c9..9728e03e12 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 <div class="cbi-section-error"><%:Invalid%></div> <%- end %> <div> - <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" /> + <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" onkeyup="cbi_validate_named_section_add(this)"/> </div> - <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" /> + <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" disabled="" /> <% end %> </div> <%- 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 @@ <div class="cbi-section-error"><%:Invalid%></div> <%- end %> <div> - <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" /> + <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" onkeyup="cbi_validate_named_section_add(this)"/> </div> - <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" /> + <input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" disabled=""/> <%- end %> </div> <%- end %> |