Skip to main content
Inspiring
January 26, 2009
Question

Close cfwindow via program?

  • January 26, 2009
  • 2 replies
  • 480 views
I have a number of forms available from a page, each of which opens in a
cfwindow. On submission I would like to show a thank you page, but it now
opens withing the cfwindow. Is there a way to close the window via CF,
and/or get the thank you page to simply open in a new window?

Thanks.


    This topic has been closed for replies.

    2 replies

    Inspiring
    January 27, 2009
    one thing to remember about forms in cfwindow (or any other cf ajax
    container):

    if you use <CFFORM> tag, the form will submit to the container it is
    displayed in;

    but if you use a regular <FORM> tag, it will submit to the main page.

    so, the simplest solution for your problem is to use regular <FORM> tag.

    but if you can't (i.e. you need the cfform's built-in validation or
    something like that), then you can simply use <CFLOCATION> at the end of
    form processing code to relocate the user to a 'thank you' page -
    cflocation will open the 'thank you' page as a main page, not inside
    cfwindow.

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    Participating Frequently
    January 27, 2009
    I would have the form submit normally, the redirect the CFWindow to a 'thank you page' that includes a button or link at the end which says

    "Click Here to Close this Window"

    The actual closing part can be done with Javascript, as seen here:

    http://javascript.internet.com/page-details/closing-windows.html

    To be fair, in the documentation for CFWindow it says that you can use a Javascript function called ColdFusion.Window.Hide to close a window, but I've never used that myself. You can see that documentation here:

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_u-z_3.html

    and more on ColdFusion.Window.Hide here:

    http://livedocs.adobe.com/coldfusion/8/htmldocs/JavaScriptFcns_30.html#1211305