libs/cbi: fix default property of ListValue fields
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 31 Jul 2009 23:22:10 +0000 (23:22 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 31 Jul 2009 23:22:10 +0000 (23:22 +0000)
libs/cbi/luasrc/view/cbi/lvalue.htm

index c6b5412..e27948a 100644 (file)
@@ -16,7 +16,7 @@ $Id$
 <% if self.widget == "select" then %>
        <select class="cbi-input-select" onchange="cbi_d_update(this.id)"<%= attr("id", cbid) .. attr("name", cbid) .. ifattr(self.size, "size") %>>
        <% for i, key in pairs(self.keylist) do -%>
-               <option id="cbi-<%=self.config.."-"..section.."-"..self.option.."-"..key%>"<%= attr("value", key) .. ifattr(self:cfgvalue(section) == key, "selected", "selected") %>><%=striptags(self.vallist[i])%></option>
+               <option id="cbi-<%=self.config.."-"..section.."-"..self.option.."-"..key%>"<%= attr("value", key) .. ifattr((self:cfgvalue(section) or self.default) == key, "selected", "selected") %>><%=striptags(self.vallist[i])%></option>
        <%- end %>
        </select>
 <% elseif self.widget == "radio" then