473,396 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Calling a function when I close a CFWindow - How?

Haitashi
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!
Nov 2 '09 #1

✓ answered by bishopt

You should be able to run any Javascript function automatically via ColdFusion.Window.onHide

I'd look at the $('.applet').show() and .hide() statements.

Replace them with simple alerts to ensure they are being called, then debug them.

For example, if you have a div with an id of 'myDiv', and you want to show it when the cfwindow is closed, call a javascript function that looks like this:

function showDiv(){
$('myDiv').style.display="block";}

the hide function would be
function hideDiv(){
$('myDiv').style.display="none";}

4 5575
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?
Nov 3 '09 #2
acoder
16,027 Expert Mod 8TB
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.
Nov 20 '09 #3
You should be able to run any Javascript function automatically via ColdFusion.Window.onHide

I'd look at the $('.applet').show() and .hide() statements.

Replace them with simple alerts to ensure they are being called, then debug them.

For example, if you have a div with an id of 'myDiv', and you want to show it when the cfwindow is closed, call a javascript function that looks like this:

function showDiv(){
$('myDiv').style.display="block";}

the hide function would be
function hideDiv(){
$('myDiv').style.display="none";}
Feb 17 '10 #4
Awesome! I had totally given up on this. Ty bishopt. :)
Feb 17 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: gf | last post by:
<script> function testme(testvar) { if (testvar=='1') { alert('testvar=1'); document.open(); document.write('This is just some text<br /><br />"); document.write('<a...
3
by: John Bokma | last post by:
I have two windows in a frame. I want to be able that each can open a pop up window and that the handle to that window can be stored somewhere, so that each can talk to the pop up. is it...
4
by: Gerry Abbott | last post by:
Hi all. I wish to call a recordset from a function. Ive tried the following approach, -------------------------------------------------------- Function PassRS() As Recordset Dim db As...
2
by: Harold | last post by:
I have page A with form field and a button and when button is clicked it opens page B in another window. Page B has a treeview control and that is all. When something is selected I want the page...
2
by: sumanthsclsdc | last post by:
Hello friends, I have a problem, I implemented a class which uses tkinter and displays the window as required, the class will create a window with listbox and inserts some items into it, I...
4
by: MLH | last post by:
I have the following saved UNION query named qryPeople2NameInNPaperAd: SELECT & " " & & " " & & " " & & ", " & & " " & AS Item, tblVehicleJobs.VehicleJobID FROM tblVehicleJobs INNER...
5
Haitashi
by: Haitashi | last post by:
Hi People: I'm studying how CFWINDOW works. I'd like to see if anyone knows of a place where they explain what JS files is usses, which clases, and how they are being called. Basically, I need a...
4
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
6
by: Ole Nielsby | last post by:
VC has a __cdecl specifier which allows functions and methods to be called with varying parameter count. (I understand this is the default for functions in general but in VC, instances use...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.