libs/cbi: Catch errors while creating named sections
[project/luci.git] / libs / cbi / luasrc / view / cbi / tblsection.htm
index 5a2b247..be7e723 100644 (file)
@@ -100,7 +100,9 @@ end
 
                <% if self.error then %>
                        <div class="cbi-section-error">
-                               <ul><% for _, e in ipairs(self.error) do %><li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li><% end %></ul>
+                               <ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%>
+                                       <li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li>
+                               <%- end end %></ul>
                        </div>
                <% end %>
 
@@ -111,8 +113,12 @@ end
                                                <% if self.anonymous then %>
                                                        <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:cbi_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 class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" title="<%:cbi_add%>" />
+                                                       <% if self.invalid_cts then -%>
+                                                               <br /><%:cbi_invalid%></div>
+                                                       <%- end %>
                                                <% end %>
                                        </div>
                                </td>