luci-base: fix escaping lua string to js repr
[project/luci.git] / modules / luci-base / luasrc / view / cbi / value.htm
index 8a08e08..c43dab5 100644 (file)
@@ -29,7 +29,7 @@
                <%- end -%>');
                <%- end %>
                <% if self.datatype then -%>
-               cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("'", "\\'")%>');
+               cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("\\", "\\\\"):gsub("'", "\\'")%>');
                <%- end %>
        //]]></script>
        <% end -%>