summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-12-05 17:37:59 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-12-05 17:37:59 +0000
commit99bf12fb631b5633e8654123aa9e3a40a168a605 (patch)
treed9332dd456cdd92158fe8a7af2c47dd8381b5537 /libs
parentb49c904552d26352f188816bfcf404b1301371b2 (diff)
libs/web: add field validation for add section name inputs
Diffstat (limited to 'libs')
-rw-r--r--libs/web/luasrc/view/cbi/tblsection.htm3
-rw-r--r--libs/web/luasrc/view/cbi/tsection.htm3
2 files changed, 4 insertions, 2 deletions
diff --git a/libs/web/luasrc/view/cbi/tblsection.htm b/libs/web/luasrc/view/cbi/tblsection.htm
index f5e01de025..860d54ed76 100644
--- a/libs/web/luasrc/view/cbi/tblsection.htm
+++ b/libs/web/luasrc/view/cbi/tblsection.htm
@@ -121,7 +121,8 @@ end
<input class="cbi-button cbi-button-add" type="submit" value="<%:Add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:Add%>" />
<% else %>
<% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
- <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <script type="text/javascript">cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>', true, 'uciname');</script>
<input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
<% if self.invalid_cts then -%>
<br /><%:Invalid%></div>
diff --git a/libs/web/luasrc/view/cbi/tsection.htm b/libs/web/luasrc/view/cbi/tsection.htm
index 9361b6d41e..549934303d 100644
--- a/libs/web/luasrc/view/cbi/tsection.htm
+++ b/libs/web/luasrc/view/cbi/tsection.htm
@@ -50,7 +50,8 @@ $Id$
<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:Add%>" />
<%- else -%>
<% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
- <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <script type="text/javascript">cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>', true, 'uciname');</script>
<input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
<% if self.invalid_cts then -%>
<br /><%:Invalid%></div>