libs/cbi: implement SimpleForm on_cancel hook in main class
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 8 Nov 2009 02:31:41 +0000 (02:31 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 8 Nov 2009 02:31:41 +0000 (02:31 +0000)
libs/cbi/luasrc/cbi.lua

index bfdfd699998eecbb5d0682e1926a4ad8b1c9d4e4..9268d412df9a607364a3e2414d0d24ffd91f0084 100644 (file)
@@ -671,6 +671,10 @@ function SimpleForm.parse(self, readinput, ...)
                return FORM_SKIP
        end
 
+       if self:formvalue("cbi.cancel") and self:_run_hooks("on_cancel") then
+               return FORM_DONE
+       end
+
        if self:submitstate() then
                Node.parse(self, 1, ...)
        end