value.htm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <%+cbi/valueheader%>
  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. %> style="width: auto" />
  6. <% 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 %>
  7. <% if #self.keylist > 0 or self.datatype then -%>
  8. <script type="text/javascript">//<![CDATA[
  9. <% if #self.keylist > 0 then -%>
  10. cbi_combobox_init('<%=cbid%>', {
  11. <%-
  12. for i, k in ipairs(self.keylist) do
  13. -%>
  14. <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
  15. <%-if i<#self.keylist then-%>,<%-end-%>
  16. <%-
  17. end
  18. -%>
  19. }, '<%- if not self.rmempty and not self.optional then -%>
  20. <%-: -- Please choose -- -%>
  21. <%- elseif self.placeholder then -%>
  22. <%-= pcdata(self.placeholder) -%>
  23. <%- end -%>', '
  24. <%- if self.combobox_manual then -%>
  25. <%-=self.combobox_manual-%>
  26. <%- else -%>
  27. <%-: -- custom -- -%>
  28. <%- end -%>');
  29. <%- end %>
  30. <% if self.datatype then -%>
  31. cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("'", "\\'")%>');
  32. <%- end %>
  33. //]]></script>
  34. <% end -%>
  35. <%+cbi/valuefooter%>