libs/cbi: various widget fixes
[project/luci.git] / libs / cbi / luasrc / view / cbi / value.htm
index 4d473bf..de083e6 100644 (file)
@@ -13,18 +13,26 @@ $Id$
 
 -%>
 <%+cbi/valueheader%>
-       <input type="text" onchange="cbi_d_update(this.id)"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section)) .. ifattr(self.size, "size") .. ifattr(self.maxlength, "maxlength") %> />
+       <input type="<%=self.password and 'password" class="cbi-input-password' or 'text" class="cbi-input-text' %>" onchange="cbi_d_update(this.id)"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section) or self.default) .. ifattr(self.size, "size")%> />
        <% if #self.keylist > 0 then -%>
        <script type="text/javascript">
                cbi_combobox_init('<%=cbid%>', {
                <%-
                        for i, k in ipairs(self.keylist) do
                -%>
-                       <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>,
+                       <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
+                       <%-if i<#self.keylist then-%>,<%-end-%>
                <%-
                        end
                -%>
-               }, '<%:cbi_select%>', '<%:cbi_manual%>');
+               }, '<%- if not self.rmempty and not self.optional then -%>
+                       <%-:cbi_select-%>
+               <%- end -%>', '
+               <%- if self.combobox_manual then -%>
+                       <%-=self.combobox_manual-%>
+               <%- else -%>
+                       <%-:cbi_manual-%>
+               <%- end -%>');
        </script>
        <% end -%>
 <%+cbi/valuefooter%>