libs/web: remove a stray non breaking space in DummyValue template
[project/luci.git] / libs / web / luasrc / view / cbi / dynlist.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15 <%+cbi/valueheader%>
16 <div>
17 <%
18         local vals = self:cfgvalue(section) or {}
19         for i=1, #vals + 1 do
20                 local val = vals[i]
21                 if (val and #val > 0) or (i == 1) then
22 %>
23         <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%=
24                 attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size") ..
25                 ifattr(i == 1 and self.placeholder, "placeholder", self.placeholder)
26         %> /><br />
27 <% end end %>
28 </div>
29 <script type="text/javascript">
30 cbi_dynlist_init('<%=cbid%>', '<%=resource%>');
31 <% if self.datatype then -%>
32         <% if #self.keylist > 0 then -%>
33                 cbi_combobox_init('<%=cbid .. "." .. i%>', {
34                 <%- for i, k in ipairs(self.keylist) do -%>
35                         <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
36                         <%-if i<#self.keylist then-%>,<%-end-%>
37                 <%-     end     -%>
38                 }, '<%- if not self.rmempty and not self.optional then -%>
39                         <%-: -- Please choose -- -%>
40                 <%- end -%>', '<%: -- custom -- %>');
41         <% end -%>
42         <% for i=1, #vals + 1 do -%>
43         cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring((self.optional or self.rmempty) == true or i > #vals)%>, '<%=self.datatype%>');
44         <%- end %>
45 <% end -%>
46 </script>
47 <%+cbi/valuefooter%>