Hi,
I implemented the how-to on alerting user before leaving a form. Now I would like to trigger a submission when the user leaves the form. How could this be achieved? I tried using the xforms-model-destruct event but this doesn't work. regards, Gerrit -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Gerrit,
The first issue is whether it's possible to reliably determine when the user is leaving the form. On the client-side, we can get a notification upon window.unload. We might be able to send an event to the server at that time to tell it that the user is leaving the form. That's something to try but currently we don't have it in standard. So I would try this: - register a JavaScript event handler on onunload - dispatch an XForms event to the server, see: ORBEON.xforms.Document.dispatchEvent("my-group", "acme-super-event"); http://wiki.orbeon.com/forms/doc/developer-guide/xforms-javascript-integration Note that you need to enable the external event with something like: <xforms:model xxforms:external-events="acme-super-event"> -Erik On Sat, Jun 30, 2012 at 4:56 AM, Gerrit Boers <[hidden email]> wrote: > Hi, > > I implemented the how-to on alerting user before leaving a form. Now I would like to trigger a submission when the user leaves the form. How could this be achieved? I tried using the xforms-model-destruct event but this doesn't work. > > regards, > > Gerrit > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Erik,
I added this to the model declaration: <xforms:model id="decor-datasets" xxforms:external-events="clear-locks-submit"> this action in the model: <xforms:action ev:event="clear-locks-submit"> <xforms:send submission="clear-locks"/> </xforms:action> and the script in the model: <xxforms:script ev:event="xforms-ready" > window.onunload = function() { ORBEON.xforms.Document.dispatchEvent('decor-datasets','clear-locks-submit'); } </xxforms:script> But it doesn't work. Am I doing something wrong? Are there any plans to implement the xforms-model-destruct event? This would seem like a good place to put 'housekeeping' actions, it seems to me that this would also be more reliable as it does not rely on the client triggering an event. regards, Gerrit On Jul 2, 2012, at 7:31 AM, Erik Bruchez wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Gerrit,
> I added this to the model declaration: > <xforms:model id="decor-datasets" > xxforms:external-events="clear-locks-submit"> > > this action in the model: > <xforms:action ev:event="clear-locks-submit"> > <xforms:send submission="clear-locks"/> > </xforms:action> > > and the script in the model: > <xxforms:script ev:event="xforms-ready" > > > window.onunload = function() { > > ORBEON.xforms.Document.dispatchEvent('decor-datasets','clear-locks-submit'); > } > </xxforms:script> > > But it doesn't work. Am I doing something wrong? If you enable XForms logging, you should see information about whether the clear-locks-submit was dispatched and/or rejected. http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging > Are there any plans to implement the xforms-model-destruct event? This would > seem like a good place to put 'housekeeping' actions, it seems to me that > this would also be more reliable as it does not rely on the client > triggering an event. Yeah it'd be nice. Adding an RFE for now: https://github.com/orbeon/orbeon-forms/issues/357 -Erik -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |