changeset 1985:9ad1a06ed0f8

frontends (xmlui): cancelling form now trigger submit with {"cancelled": "true"} instead of being silently ignored
author Goffi <goffi@goffi.org>
date Wed, 29 Jun 2016 13:51:39 +0200 (2016-06-29)
parents de4fac507dc4
children fbd313cfd40b
files frontends/src/tools/xmlui.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/tools/xmlui.py	Wed Jun 29 13:46:14 2016 +0200
+++ b/frontends/src/tools/xmlui.py	Wed Jun 29 13:51:39 2016 +0200
@@ -663,6 +663,11 @@
     def onFormCancelled(self, ignore=None):
         """Called when a form is cancelled"""
         log.debug(_("Cancelling form"))
+        if self.submit_id is not None:
+            data = {C.XMLUI_DATA_CANCELLED: C.BOOL_TRUE}
+            self.submit(data)
+        else:
+            log.warning(_("The form data is not sent back, the type is not managed properly"))
         self._xmluiClose()
 
     def onSaveParams(self, ignore=None):