2 <input type="<%=self.password and 'password" class="cbi-input-password' or 'text" class="cbi-input-text' %>" onchange="cbi_d_update(this.id)"<%=
3 attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section) or self.default) ..
4 ifattr(self.size, "size") .. ifattr(self.placeholder, "placeholder") ..
5 ifattr(self.readonly, "readonly") .. ifattr(self.maxlength, "maxlength")
7 <% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
8 <% if #self.keylist > 0 or self.datatype then -%>
9 <script type="text/javascript">//<![CDATA[
10 <% if #self.keylist > 0 then -%>
11 cbi_combobox_init('<%=cbid%>', {
13 for i, k in ipairs(self.keylist) do
15 <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
16 <%-if i<#self.keylist then-%>,<%-end-%>
20 }, '<%- if not self.rmempty and not self.optional then -%>
21 <%-: -- Please choose -- -%>
22 <%- elseif self.placeholder then -%>
23 <%-= pcdata(self.placeholder) -%>
25 <%- if self.combobox_manual then -%>
26 <%-=self.combobox_manual-%>
31 <% if self.datatype then -%>
32 cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("\\", "\\\\"):gsub("'", "\\'")%>');