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 bfdfd69..9268d41 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