diff --git a/webroot/rsrc/externals/javelin/lib/Workflow.js b/webroot/rsrc/externals/javelin/lib/Workflow.js index 25de547deb..7d63a3408a 100644 --- a/webroot/rsrc/externals/javelin/lib/Workflow.js +++ b/webroot/rsrc/externals/javelin/lib/Workflow.js @@ -403,6 +403,16 @@ JX.install('Workflow', { JX.$E('Response to workflow request went unhandled.'); } } + + var form = JX.DOM.scry(this._root, 'form', 'jx-dialog'); + if (form.length) { + JX.DOM.listen(form[0], 'keydown', null, function(e) { + if (e.getSpecialKey()) { + return; + } + JX.Stratcom.addSigil(form[0], 'dialog-keydown'); + }); + } }, _push : function() { if (!this._pushed) { @@ -536,6 +546,15 @@ JX.install('Workflow', { return; } + var form = JX.DOM.scry(active._root, 'form', 'jx-dialog'); + if ( + form.length && + JX.Stratcom.hasSigil(form[0], 'dialog-keydown') && + !confirm('Form data may have changed. Are you sure you want to close this dialog?') + ) { + return; + } + JX.Workflow._pop(); e.prevent(); }