summaryrefslogtreecommitdiffhomepage
path: root/libs/cbi/luasrc/view
diff options
context:
space:
mode:
Diffstat (limited to 'libs/cbi/luasrc/view')
-rw-r--r--libs/cbi/luasrc/view/cbi/dynlist.htm9
-rw-r--r--libs/cbi/luasrc/view/cbi/ucisection.htm12
2 files changed, 19 insertions, 2 deletions
diff --git a/libs/cbi/luasrc/view/cbi/dynlist.htm b/libs/cbi/luasrc/view/cbi/dynlist.htm
index 8e2bda8f98..826e2e698e 100644
--- a/libs/cbi/luasrc/view/cbi/dynlist.htm
+++ b/libs/cbi/luasrc/view/cbi/dynlist.htm
@@ -1,7 +1,7 @@
<%#
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -42,4 +42,11 @@ $Id$
<% end -%>
<% if i <= #vals then %><br />
<% end end %>
+<% if self.datatype then -%>
+ <script type="text/javascript">
+ <% for i=1, #vals + 1 do -%>
+ cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring(self.optional == true or i > #vals)%>, '<%=self.datatype%>');
+ <%- end %>
+ </script>
+<% end -%>
<%+cbi/valuefooter%>
diff --git a/libs/cbi/luasrc/view/cbi/ucisection.htm b/libs/cbi/luasrc/view/cbi/ucisection.htm
index b184908b0b..db32c90439 100644
--- a/libs/cbi/luasrc/view/cbi/ucisection.htm
+++ b/libs/cbi/luasrc/view/cbi/ucisection.htm
@@ -31,7 +31,17 @@ $Id$
<% if self.error and self.error[section] then -%>
<div class="cbi-section-error">
- <ul><% for _, e in ipairs(self.error[section]) do %><li><%=pcdata(e):gsub("\n","<br />")%></li><% end %></ul>
+ <ul><% for _, e in ipairs(self.error[section]) do -%>
+ <li>
+ <%- if e == "invalid" then -%>
+ <%:One or more fields contain invalid values!%>
+ <%- elseif e == "missing" then -%>
+ <%:One or more required fields have no value!%>
+ <%- else -%>
+ <%=pcdata(e)%>
+ <%- end -%>
+ </li>
+ <%- end %></ul>
</div>
<%- end %>