libs/cbi: Make sure newly created sections have optional field selectors
authorSteven Barth <steven@midlink.org>
Sat, 30 Aug 2008 20:32:13 +0000 (20:32 +0000)
committerSteven Barth <steven@midlink.org>
Sat, 30 Aug 2008 20:32:13 +0000 (20:32 +0000)
libs/cbi/luasrc/cbi.lua

index fe20773..5b05c46 100644 (file)
@@ -735,11 +735,12 @@ function TypedSection.parse(self)
 
        if self.addremove then
                -- Create
 
        if self.addremove then
                -- Create
+               local created
                local crval = CREATE_PREFIX .. self.config .. "." .. self.sectiontype
                local name  = luci.http.formvalue(crval)
                if self.anonymous then
                        if name then
                local crval = CREATE_PREFIX .. self.config .. "." .. self.sectiontype
                local name  = luci.http.formvalue(crval)
                if self.anonymous then
                        if name then
-                               self:create()
+                               created = self:create()
                        end
                else
                        if name then
                        end
                else
                        if name then
@@ -755,10 +756,14 @@ function TypedSection.parse(self)
                                end
 
                                if name and #name > 0 then
                                end
 
                                if name and #name > 0 then
-                                       self:create(name)
+                                       created = self:create(name) and name
                                end
                        end
                end
                                end
                        end
                end
+
+               if created then
+                       AbstractSection.parse_optionals(self, created)
+               end
        end
 end
 
        end
 end