2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
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
10 http://www.apache.org/licenses/LICENSE-2.0
18 local vals = self:cfgvalue(section) or {}
22 <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%=
23 attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size") ..
24 ifattr(i == 1 and self.placeholder, "placeholder", self.placeholder)
28 <script type="text/javascript">
29 cbi_dynlist_init('<%=cbid%>');
30 <% if self.datatype then -%>
31 <% if #self.keylist > 0 then -%>
32 cbi_combobox_init('<%=cbid .. "." .. i%>', {
33 <%- for i, k in ipairs(self.keylist) do -%>
34 <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
35 <%-if i<#self.keylist then-%>,<%-end-%>
37 }, '<%- if not self.rmempty and not self.optional then -%>
39 <%- end -%>', '<%: -- custom -- %>');
41 <% for i=1, #vals + 1 do -%>
42 cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring(self.optional == true or i > #vals)%>, '<%=self.datatype%>');