summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/cbi/luasrc/cbi.lua8
-rw-r--r--libs/web/luasrc/dispatcher.lua6
2 files changed, 11 insertions, 3 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index ff5296e35f..328722f9ab 100644
--- a/libs/cbi/luasrc/cbi.lua
+++ b/libs/cbi/luasrc/cbi.lua
@@ -352,13 +352,15 @@ function Map.parse(self)
if self:submitstate() then
if self.save then
- return self.changed and FORM_CHANGED or FORM_VALID
+ self.state = self.changed and FORM_CHANGED or FORM_VALID
else
- return FORM_INVALID
+ self.state = FORM_INVALID
end
else
- return FORM_NODATA
+ self.state = FORM_NODATA
end
+
+ return self.state
end
function Map.render(self, ...)
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 51f6d9695f..22d9dd9bc3 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -521,6 +521,12 @@ function cbi(model, config)
end
end
+ if config.state_handler then
+ if not config.state_handler(state, maps) then
+ return
+ end
+ end
+
local pageaction = true
http.header("X-CBI-State", state or 0)
luci.template.render("cbi/header", {state = state})