If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

trapping the exit of a prompt screen

Started by irvingbos, 17 Nov 2015 02:28:28 PM

Previous topic - Next topic

irvingbos

Hi, I am interested if anyone knows of a technique to trap the exit event (closing the window) of a Cognos prompt screen. I am guessing it will involve Javascript / JQuery, which is fine, but not sure from there..  any suggestions are welcomed!

bdbits

What are you actually trying to accomplish? If you want to add custom validation, the prompt API (javascript) has hooks for that without trying to trap events.

My concern with hooking into an event is that it might change in your next version upgrade. Cognos says they will maintain prompt API compatability in future releases.

irvingbos

Hi, we have a prompt screen where users can select customers (possibly 100s). It also has the ability to write some simple data (esentailly lists of thier selections, so they re-use them in the future) back to the databse (via SPs). These lists first get stored as cookies, then when the 'submit' happens the data is written to database. I want to warn the user in the scenario that they have saved a list to a cookie, but is now bailing out of the prompt screen, so the write back to the datbase never happens. The warning would be something to the effect that they might lose that list if their cookies get cleared.
Does that help?

bdbits

Yes; that must be a lot of javascript you got going on there. :)

I think you want to add a listener to the window beforeunload event, which unlike unload can be cancelled. I have sometimes noticed Cognos code will override event handlers, which can be a royal pain in the behind to overcome. But that is what I would try first.

irvingbos

thanks bdbits, will try that; I was realized after i posted that it is not just close window i would need to trap, but also the back button in the browser, and possibly more spots.. Essentially, when-ever the report closes, through any means.  this could get interesting..

bdbits

Sometimes what seem like different actions will trigger the same events, so you may find beforeunload gets triggered with a back button, etc. I don't have a reference for what action triggers what events, but if you get it working for one you can then try the others and see if it triggers the same event. I would start with just an alert() for testing purposes. You should be able to create one function to hook to however many events you need.