libs/web: pass origin section id to :create() callback, needed when multiple, filtere...
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 9 Oct 2011 20:07:02 +0000 (20:07 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 9 Oct 2011 20:07:02 +0000 (20:07 +0000)
libs/web/luasrc/cbi.lua

index 5aa2f5a092ef604c8628d1e1b96ec1455fd70ff9..86658d70209bf0fbc79c108b5791519cbc4dec7d 100644 (file)
@@ -1095,10 +1095,10 @@ function TypedSection.parse(self, novld)
                -- Create
                local created
                local crval = CREATE_PREFIX .. self.config .. "." .. self.sectiontype
-               local name  = self.map:formvalue(crval)
+               local origin, name = next(self.map:formvaluetable(crval))
                if self.anonymous then
                        if name then
-                               created = self:create()
+                               created = self:create(nil, origin)
                        end
                else
                        if name then
@@ -1114,7 +1114,7 @@ function TypedSection.parse(self, novld)
                                end
 
                                if name and #name > 0 then
-                                       created = self:create(name) and name
+                                       created = self:create(name, origin) and name
                                        if not created then
                                                self.invalid_cts = true
                                        end