From 0d4ec2bbba8479154e63824e5315a0e0e01087a2 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 9 Oct 2011 18:43:11 +0000 Subject: [PATCH] libs/web: add error message printing to nullsection template, fixes server side validation in SimpleForm instances --- libs/web/luasrc/view/cbi/nullsection.htm | 51 ++++++++++++++++-------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/libs/web/luasrc/view/cbi/nullsection.htm b/libs/web/luasrc/view/cbi/nullsection.htm index 063e7e6e61..9a91432ad8 100644 --- a/libs/web/luasrc/view/cbi/nullsection.htm +++ b/libs/web/luasrc/view/cbi/nullsection.htm @@ -1,18 +1,35 @@ -
- <% if self.title and #self.title > 0 then -%> - <%=self.title%> - <%- end %> -
- <% self:render_children(1, scope or {}) %> +
+ <% if self.title and #self.title > 0 then -%> + <%=self.title%> + <%- end %> +
+
+ <% self:render_children(1, scope or {}) %> +
+ <% if self.error and self.error[1] then -%> +
+
    <% for _, e in ipairs(self.error[1]) do -%> +
  • + <%- 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 -%> +
  • + <%- end %>
-
-
- <%- - if type(self.hidden) == "table" then - for k, v in pairs(self.hidden) do - -%> - - <%- - end - end - %> + <%- end %> +
+
+
+<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> -- 2.30.2