libs/cbi: Fixed DynamicLists

This commit is contained in:
Steven Barth 2008-09-07 23:03:05 +00:00
parent 7fb577f21e
commit 2590722de0
2 changed files with 4 additions and 3 deletions

View file

@ -1227,7 +1227,7 @@ function StaticList.validate(self, value)
local valid = {} local valid = {}
for i, v in ipairs(value) do for i, v in ipairs(value) do
if luci.util.contains(self.valuelist, v) then if luci.util.contains(self.vallist, v) then
table.insert(valid, v) table.insert(valid, v)
end end
end end

View file

@ -13,13 +13,14 @@ $Id$
-%> -%>
<%+cbi/valueheader%> <%+cbi/valueheader%>
<%
local vals = self:cfgvalue(section) local vals = self:cfgvalue(section)
for i=1, #vals + 1 do for i=1, #vals + 1 do
local val = vals[i] local val = vals[i]
%> %>
<input onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(val, "value") .. ifattr(self.size, "size")%> /> <input value="<%=val%>" onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size")%> />
<% if i <= #vals then %> <% if i <= #vals then %>
<input type="image" value="<%:cbi_del%>" name="cbi.rle.<%=section .. "." .. self.option .. "." i%>" alt="<%:cbi_del%>" title="<%:cbi_del%>" src="<%=resource%>/cbi/remove.gif" /> <input type="image" value="<%:cbi_del%>" name="cbi.rle.<%=section .. "." .. self.option .. "." .. i%>" alt="<%:cbi_del%>" title="<%:cbi_del%>" src="<%=resource%>/cbi/remove.gif" />
<% else %> <% else %>
<input type="image" value="<%:cbi_add%>" name="cbi.ale.<%=section .. "." .. self.option%>" alt="<%:cbi_add%>" title="<%:cbi_add%>" src="<%=resource%>/cbi/add.gif" /> <input type="image" value="<%:cbi_add%>" name="cbi.ale.<%=section .. "." .. self.option%>" alt="<%:cbi_add%>" title="<%:cbi_add%>" src="<%=resource%>/cbi/add.gif" />
<% end %> <% end %>