Cfwindow close and send information to the main page

I would like to use Cfwindow to pop up a cffileupload script, but when the loader is finish uploading the files, I would like it to close and display the loaded content on the main page. I got the cfwindow and cffileuploader part done. Is there a way to do the rest?
overcolorAsked:
Who is Participating?
 
_agx_Connect With a Mentor Commented:
It's late and I'll be heading to sleep soon, but I think you may be misunderstanding the example.  

Since you didn't post any code - I created a full example from scratch. So you could have a working example that shows how to create AND close a cfwindow.  In your actual code, all you need to do is add the function that closes the window to your main page:

<script type="text/javascript">
     function closeCFWindow() {
            ColdFusion.Window.hide('yourWindow');
      }
</script>

... then call that function from your cffileupload tag. Make sense?

 <cffileupload  
          onUploadComplete="closeCFWindow"
          ... other attributes ....>

0
 
_agx_Commented:
Try using the onUploadComplete function to hide/close the window with ColdFusion.Window.xxxx.  The onUploadComplete function fires when all of the files have finished uploading.
0
 
overcolorAuthor Commented:
Ok I tried that and I think I did it wrong, where do I put that and can I put a url in the script?

onUploadComplete="page.cfm?id=5"

?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
_agx_Commented:
No it needs to be a javascript function.

<a href="javascript:ColdFusion.Window.show('yourWindow')">Show Window</a>

<script type="text/javascript">
      function closeCFWindow() {
            ColdFusion.Window.hide('yourWindow');
      }
</script>
<cfwindow width="500" height="250"  name="yourWindow">
      <cffileupload  
          url="uploadTarget.cfm"
          onUploadComplete="closeCFWindow"
          progressbar="true"
          name="yourUpload"
          width="450"
          height="200"
            />
</cfwindow>
0
 
overcolorAuthor Commented:
I'm sorry I forgot to tell you something, I have a Cfwindow that allows the user to create the album name, it runs a Cfabort, if everything is pass ok, creates the gallery and displays the CFfileuploader. Once they upload the image I would like the loader to close and go to the main page?? So is there a way to tell the Cffileuploaer to close the current window it is in once done?
0
 
_agx_Commented:
> So is there a way to tell the Cffileuploaer to close the current window it is in once done?

That's what the code above does.  If you want to redirect the page as well, do a regular javascript redirect right after ColdFusion.Window.hide('yourWindow'); closes the cfwindow.

ie
 function closeCFWindow() {
            ColdFusion.Window.hide('yourWindow');
            // ... <=== put the redirect here
 }
0
 
overcolorAuthor Commented:
ok let me try
0
 
overcolorAuthor Commented:
Im getting the link, but it does not work when I click it, I already have the CFfileuploader in a CFwindow because it is being called on from the CFabort in the Album creation script..Does that matter?

I think I'm explain it wrong. I don't need a new CFwindow, I just need the current on to close after the image uploads

(1) show the album creation window, once passed then displays the (2) cffileuploader in the same window

(3) is what i get with the new script (link does not work)?


1.png
2.png
3.png
0
 
overcolorAuthor Commented:
Perfect, the problem was I called the cfwindow a different name on the first page that created the album in the beginning and I was trying to use another name on the up loader. I didn't know the cfwindow name passes over...Sorry and Thank you..
0
 
_agx_Commented:
No problem. Glad you got it sorted out.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.