libs/web: treat .rmempty like .optional for live field validation
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 16 Nov 2010 18:05:17 +0000 (18:05 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 16 Nov 2010 18:05:17 +0000 (18:05 +0000)
libs/web/luasrc/view/cbi/dynlist.htm
libs/web/luasrc/view/cbi/value.htm

index 387299d..5f57941 100644 (file)
@@ -39,7 +39,7 @@ cbi_dynlist_init('<%=cbid%>');
                <%- end -%>', '<%: -- custom -- %>');
        <% end -%>
        <% for i=1, #vals + 1 do -%>
-       cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring(self.optional == true or i > #vals)%>, '<%=self.datatype%>');
+       cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring((self.optional or self.rmempty) == true or i > #vals)%>, '<%=self.datatype%>');
        <%- end %>
 <% end -%>
 </script>
index 84daafd..d94863e 100644 (file)
@@ -40,7 +40,7 @@ $Id$
                <%- end -%>');
                <%- end %>
                <% if self.datatype then -%>
-               cbi_validate_field('<%=cbid%>', <%=tostring(self.optional == true)%>, '<%=self.datatype%>');
+               cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype%>');
                <%- end %>
        </script>
        <% end -%>