Connecting Tech Pros Worldwide Forums | Help | Site Map

Calling a function when I close a CFWindow - How?

Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#1: 3 Weeks Ago
I have a link and opens up a CFWindow. I'm using the default CFWindow skin. I would like to execute a specific function when the user clicks on the X button.

I would like to show a div (which will be hidden by default) when I close the CFWindow. I assume I can use ColdFusion.Window.onHide somehow but I don't know how.

All the examples I've seen on the net use a href link to call the onHide handler. I would like to call this event handler when a user closes the window using the X that comes by default in the CFWindow ...er...window? :)

Thanks in advance!

Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#2: 3 Weeks Ago

re: Calling a function when I close a CFWindow - How?


Ok. I got it to work but only slightly...

On my display page I have this:
Expand|Select|Wrap|Line Numbers
  1. <cfset AjaxOnLoad("setCFWindowHooks") />
And on the included JS file for that page I have this:
Expand|Select|Wrap|Line Numbers
  1. function hideJavaLoader(name) {
  2.     console.log('You just opened ' + name + ' CFWINDOW');
  3.     $('.applet').hide();
  4. }
  5. //This will show the Java uploader when a video window is closed
  6. function showJavaLoader(name) {
  7.     console.log('You just hid ' + name + ' CFWINDOW');
  8.     $('.applet').show();
  9. }
  10. setCFWindowHooks = function() {
  11.     console.info("Adding ColdFusion window hooks...");
  12.     ColdFusion.Window.onShow('myVideo', hideJavaLoader);
  13.     ColdFusion.Window.onHide('myVideo', showJavaLoader);
  14.     console.info("...done");
  15. }; 
This code is only working in FF and firebug might be the reason why. If I eliminate those "console.log" statements, then it stops working. I don't get it. Any ideas?
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: 1 Week Ago

re: Calling a function when I close a CFWindow - How?


I've not really worked with CFWindow (had no need to), but according to this, your code should work. Try an alert and see if that works.
Reply