Skip to main content
July 7, 2008
Question

Destroy a cfwindow

  • July 7, 2008
  • 5 replies
  • 2815 views
Hi all,

Given the trouble I mentioned in my "bind failed, element not found" post on 7/3, I'd like to just destroy a js-created cfwindow when it's hidden (using the onhide event), and create a new one each time. Does anyone know how to destroy a cfwindow. I would have thought it would be along the lines of:

ColdFusion.Window.getWindowObject('MyWindow').destroy();

But that doesn't work.

Thanks,
Russ
    This topic has been closed for replies.

    5 replies

    Participant
    November 20, 2014

    Try this way, works fine for me.

    ColdFusion.Window.create(....);

    ColdFusion.Window.onHide("windowName",function(){

                                                                               ColdFusion.Window.destroy("windowName")});

    Participating Frequently
    July 21, 2011

    You can only hide the window

    ColdFusion.Window.hide('myWindow');

    Participant
    July 8, 2010

    I tried destroying a window and recreating to solve my original problem, after updating to 8.0.1, but it doesn't solve the problem (must be same old window).

    http://forums.adobe.com/message/2950095#2950095

    March 5, 2009
    I *am* running 8.0.1 and this does not work as expected. First time I open the window, everything works fine. Subsequent attempts to open other windows with the same name result in window title at the top and all else blank. I can still only use the window for the one attempt.

    Here is my code:
    <CFAJAXIMPORT TAGS="CFWINDOW">
    ...

    try {
    ColdFusion.Window.destroy('WindowName',true);
    } catch(e) {}

    ...

    ColdFusion.Window.create('WindowName', 'Window Title','[url here]', config_string);

    ...

    Is anyone aware of further issues? Most of the information I have found predates 8.0.1...
    Inspiring
    July 7, 2008
    cose, very close!

    from cf 8.0.1 release notes:

    "You can now use the following ColdFusion AJAX JavaScript function,
    which destroys a window instance:
    ColdFusion.Window.destroy(windowName[, destroyElement])
    - windowName The name of the window to destroy
    - destroyElement A Boolean value specifying whether the HTML element
    associated with the window should also be destroyed. The default value
    is false."

    this is only available in cf 8 Update 1 (cf8.0.1) - not in cf8.

    hth

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    July 7, 2008
    Thank you so much, Azadi. I'll give that a shot.

    Russ