4 local vals = self:cfgvalue(section) or {}
7 if (val and #val > 0) or (i == 1) then
9 <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%=
10 attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size") ..
11 ifattr(i == 1 and self.placeholder, "placeholder", self.placeholder)
15 <script type="text/javascript">
16 cbi_dynlist_init('<%=cbid%>', '<%=resource%>');
17 <% if self.datatype then -%>
18 <% if #self.keylist > 0 then -%>
19 cbi_combobox_init('<%=cbid .. "." .. i%>', {
20 <%- for i, k in ipairs(self.keylist) do -%>
21 <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
22 <%-if i<#self.keylist then-%>,<%-end-%>
24 }, '<%- if not self.rmempty and not self.optional then -%>
25 <%-: -- Please choose -- -%>
26 <%- end -%>', '<%: -- custom -- %>');
28 <% for i=1, #vals + 1 do -%>
29 cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring((self.optional or self.rmempty) == true or i > #vals)%>, '<%=self.datatype%>');