lvalue.htm 1.1 KB

123456789101112131415161718
  1. <%+cbi/valueheader%>
  2. <% if self.widget == "select" then %>
  3. <select class="cbi-input-select" onchange="cbi_d_update(this.id)"<%= attr("id", cbid) .. attr("name", cbid) .. ifattr(self.size, "size") %>>
  4. <% for i, key in pairs(self.keylist) do -%>
  5. <option id="cbi-<%=self.config.."-"..section.."-"..self.option.."-"..key%>"<%= attr("value", key) .. ifattr(tostring(self:cfgvalue(section) or self.default) == key, "selected", "selected") %>><%=striptags(self.vallist[i])%></option>
  6. <%- end %>
  7. </select>
  8. <% elseif self.widget == "radio" then
  9. local c = 0
  10. for i, key in pairs(self.keylist) do
  11. c = c + 1
  12. %>
  13. <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%= attr("id", cbid..c) .. attr("name", cbid) .. attr("value", key) .. ifattr((self:cfgvalue(section) or self.default) == key, "checked", "checked") %> />
  14. <label<%= attr("for", cbid..c) %>><%=self.vallist[i]%></label>
  15. <% if c == self.size then c = 0 %><% if self.orientation == "horizontal" then %>&#160;<% else %><br /><% end %>
  16. <% end end %>
  17. <% end %>
  18. <%+cbi/valuefooter%>