This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 7, 2011, 3:16 PM
16 Posts

Trap window closing in XPiNC

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: dojo,connect,listener,csjs
  • Replies: 2
I am trying to listen for/trap when the user clicks the "X" on the tab in the XPiNC (and basically any event that closes the window other than hitting the escape key as I have a dojo.connect function that listens for the escape key and runs some code - a long story but it's all to do with redirecting to another url)
 
If I put the following code into a script block, it works fine in a browser but not in the Notes client...

 dojo.connect( window, 'onbeforeunload', function(f){ 
      boolFlag ='#{javascript:sessionScope.ssCanUnload}';
      alert(boolFlag);
  })
 
Does anyone know what event I should be connecting to for this code to work in the Notes client? I've tried a combination of document/window and onbeforeunload/beforeunload etc. I need to run my code BEFORE the window./document is unloaded so that I can check that value of my sessionScope variable and return false to stop the user where appropriate

Or am I coming at this from completely the wrong angle?

Many thanks
 
Mike
Mar 8, 2011, 7:27 AM
41 Posts
Re: Trap window closing in XPiNC
 The ViewRoot (the base tag of an XPage) supports three related properties that impact this behavior for XPiNC:
 
  1. enableModifiedFlag - if true, the page will monitor the state of all editable components to identify if any have been modified, similar to how Form elements behave in the Notes client
  2. modifiedMessage - text of the prompt that will display to the user if they attempt to close a page that is considered to have been modified
  3. modifiedControl - Id of the component that contains the action to handle "saving" the page if the user responds affirmatively to the above confirmation

Mar 8, 2011, 1:53 PM
16 Posts
Re: Trap window closing in XPiNC
Tim,
 
Many thank for the guidance

If my XPage is not being modified in any way (it is purely a page for searching and viewing results in a view panel control), how can I trap the closing of the document/window?
 
Mike

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal