Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:49:14+00:00 2026-05-29T11:49:14+00:00

ISSUE: code that worked to close and destroy a cfwindow after form submit –

  • 0

ISSUE: code that worked to close and destroy a cfwindow after form submit – HAD to be changed to use iFrame (to accommodate file upload). now the ‘close’ does NOT work.

how does one close a cfwindow that contains an iframe… once the iframe form is submitted????

FLOW:

Base page -> opens window

window contains iframe; iframe -> calls form page

form page -> submit to action page (same page)

action page -> uploads file and does other form processing – closes window.

=====

NOTE: I have reduced the code to the essence – for ease of reading… if blocks of JS need to (or ‘should’) go elsewhere and be referenced in some other way – please let me know…

BASE PAGE – basePage.cfm:

<script>
    function launchWin(name,url) {
        ColdFusion.Window.create(name+'_formWindow', name, url, 
    {   height:500,
        width:500,
        modal:true,
        closable:true, 
        draggable:true,
        resizable:true,
        center:true,
        initshow:true, 
        minheight:200,
        minwidth:200 
    })
}
</script>
<a href="javascript:launchWin( 'Attachment', 'iframe.cfm?id=101' );" >ATTACH</a>
<DIV ID="myContent"></div>

===========================================

WINDOW PAGE – iframe.cfm – (iframe):

<iframe src="attachment.cfm?id=101"></iframe>

===========================================

IFRAME SRC – attachment.cfm (note – this code worked b4 putting it in an iFrame):

<script>
ColdFusion.Window.onHide( 'Attachment_formWindow', cleanup );
function cleanup() {
    ColdFusion.Window.destroy( 'Attachment_formWindow', true );
}
</script>


<!--- HANDLE THE FORM --->
<cfif structKeyExists( FORM, 'add_Attachment' )  >
    <!--- Do CFFILE to handle file upload --->
    <cffile action="upload"
            destination="C:\"
            filefield="theFile"
            nameconflict="makeunique">
    <!--- other form processing goes here (not relevant to question at hand) --->
    <!--- refresh the calling page, and close this window - destroy it so contents don't presist --->
    <script>
        ColdFusion.navigate( 'basePage.cfm?', 'myContent' );
        ColdFusion.Window.hide( 'Attachment_formWindow' );
    </script>       
</cfif>


<!--- form to get information --->
<cfform name="attachmentForm" enctype="multipart/form-data"  >
<table>
    <tr><td>FILE:</td><td><cfinput type="file" name="theFile" size="40" /></td></tr>
    <tr><td>TITLE:</td><td><cfinput type="text" name="name" value="" size="40" maxlength="100" /></td></tr>
    <tr><td>DESCRIPTION:</td><td><cftextarea name="description" cols="40" rows="10"></cftextarea></td></tr>
    <tr><td></td><td><cfinput type="submit" name="add_Attachment" value="Add" /></td></tr>
</table>
</cfform> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:49:17+00:00Added an answer on May 29, 2026 at 11:49 am

    When you move code to an iframe, you have to change the references in the javascript to refer to the parent., since the iframe introduces its own child context (vs. a div, which lives within the original context).

    Try this:

    <script>
    parent.ColdFusion.Window.onHide( 'Attachment_formWindow', cleanup );
    function cleanup() {
        parent.ColdFusion.Window.destroy( 'Attachment_formWindow', true );
    }
    </script>
    
    
    <!--- HANDLE THE FORM --->
    <cfif structKeyExists( FORM, 'add_Attachment' )  >
        <!--- Do CFFILE to handle file upload --->
        <cffile action="upload"
                destination="C:\"
                filefield="theFile"
                nameconflict="makeunique">
        <!--- other form processing goes here (not relevant to question at hand) --->
        <!--- refresh the calling page, and close this window - destroy it so contents don't presist --->
        <script>
            parent.ColdFusion.navigate( 'basePage.cfm?', 'myContent' );
            parent.ColdFusion.Window.hide( 'Attachment_formWindow' );
        </script>       
    </cfif>
    
    
    <!--- form to get information --->
    <cfform name="attachmentForm" enctype="multipart/form-data"  >
    <table>
        <tr><td>FILE:</td><td><cfinput type="file" name="theFile" size="40" /></td></tr>
        <tr><td>TITLE:</td><td><cfinput type="text" name="name" value="" size="40" maxlength="100" /></td></tr>
        <tr><td>DESCRIPTION:</td><td><cftextarea name="description" cols="40" rows="10"></cftextarea></td></tr>
        <tr><td></td><td><cfinput type="submit" name="add_Attachment" value="Add" /></td></tr>
    </table>
    </cfform> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My issue is with a certain style of code that very much resembles recursion,
I'm trying to track down an issue in our MFC code that looks like
An interesting issue came up recently. We came across some code that is using
Okay, of course it is possible, that's no issue. In my code I have
I'm running a weird issue here. I have code that makes jquery ajax calls
I had this code StreamWriter sw = new StreamWriter(this.FileName, true); sw.WriteLine(text); sw.Close(); Which I
I have a new laptop at work and code that worked earlier in the
I'm working on some code that uses Open Dynamics Engine . I've worked with
I am troubleshooting a problem with existing code that always worked fine (it's the
What are good ways of dealing with the issues surrounding plugin code that interacts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.