libs/cbi: Fixed rendering of checkbox and radiobox-based widgets

This commit is contained in:
Steven Barth 2008-07-06 11:24:26 +00:00
parent 6e2fe3af63
commit 0fac926065
2 changed files with 4 additions and 2 deletions

View file

@ -9,7 +9,8 @@
local c = 0; local c = 0;
for i, key in pairs(self.keylist) do for i, key in pairs(self.keylist) do
c = c + 1%> c = c + 1%>
<%=self.vallist[i]%><input type="radio" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == key then %> checked="checked"<% end %> value="<%=key%>" /> <input type="radio" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == key then %> checked="checked"<% end %> value="<%=key%>" />
<label for="cbid.<%=self.config.."."..section.."."..self.option%>"><%=self.vallist[i]%></label><br />
<% if c == self.size then c = 0 %><br /> <% if c == self.size then c = 0 %><br />
<% end end %> <% end end %>
<% end %> <% end %>

View file

@ -12,7 +12,8 @@ local v = self:valuelist(section)
local c = 0; local c = 0;
for i, key in pairs(self.keylist) do for i, key in pairs(self.keylist) do
c = c + 1%> c = c + 1%>
<%=self.vallist[i]%><input type="checkbox" name="cbid.<%=self.config.."."..section.."."..self.option%>[]"<% if luci.util.contains(v, key) then %> checked="checked"<% end %> value="<%=key%>" /> <input type="checkbox" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if luci.util.contains(v, key) then %> checked="checked"<% end %> value="<%=key%>" />
<label for="cbid.<%=self.config.."."..section.."."..self.option%>"><%=self.vallist[i]%></label><br />
<% if c == self.size then c = 0 %><br /> <% if c == self.size then c = 0 %><br />
<% end end %> <% end end %>
<% end %> <% end %>