luci-base: fix escaping lua string to js repr

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
Yousong Zhou 2015-11-25 22:39:27 +08:00
parent 9b30357454
commit 862b84feb2

View 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 -%>