libs/web: add error message printing to nullsection template, fixes server side validation in SimpleForm instances

This commit is contained in:
Jo-Philipp Wich 2011-10-09 18:43:11 +00:00
parent 4e538d09e1
commit 0d4ec2bbba

View file

@ -3,8 +3,25 @@
<legend><%=self.title%></legend> <legend><%=self.title%></legend>
<%- end %> <%- end %>
<div class="cbi-section-node" id="cbi-<%=self.config%>-<%=tostring(self):sub(8)%>"> <div class="cbi-section-node" id="cbi-<%=self.config%>-<%=tostring(self):sub(8)%>">
<div>
<% self:render_children(1, scope or {}) %> <% self:render_children(1, scope or {}) %>
</div> </div>
<% if self.error and self.error[1] then -%>
<div class="cbi-section-error">
<ul><% for _, e in ipairs(self.error[1]) 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 %>
</div>
<br /> <br />
</fieldset> </fieldset>
<%- <%-