2 <input data-update="change"<%=
5 attr("type", self.password and "password" or "text") ..
6 attr("class", self.password and "cbi-input-password" or "cbi-input-text") ..
7 attr("value", self:cfgvalue(section) or self.default) ..
8 ifattr(self.size, "size") ..
9 ifattr(self.placeholder, "placeholder") ..
10 ifattr(self.readonly, "readonly") ..
11 ifattr(self.maxlength, "maxlength")
13 <% 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 %>
14 <% if #self.keylist > 0 or self.datatype then -%>
15 <script type="text/javascript">//<![CDATA[
16 <% if #self.keylist > 0 then -%>
17 cbi_combobox_init('<%=cbid%>', {
19 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-%>
26 }, '<%- if not self.rmempty and not self.optional then -%>
27 <%-: -- Please choose -- -%>
28 <%- elseif self.placeholder then -%>
29 <%-= pcdata(self.placeholder) -%>
31 <%- if self.combobox_manual then -%>
32 <%-=self.combobox_manual-%>
37 <% if self.datatype then -%>
38 cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("\\", "\\\\"):gsub("'", "\\'")%>');