ColdFusion 8: CFWINDOW caches content

Posted At : June 5, 2007 5:54 AM | Posted By : Dave
Related Categories: ColdFusion

Well, I knew it would happen eventually. I knew it was only a matter of time that I would find a new feature of CF8 that would just tick me off. I finally found this in CFWINDOW. While the concept and intention is great I think that the implementation is crap.

First off lets start with the fact that it caches the content. If you call the window with a source it gets the source on first open. If the window is closed and then opened again the window does not get new content.

Next, if you want to load it based on a link using bind you have to use CFFORM. You can not just use an html form. By using CFFORM you add excessive bloat.

Resizing of the window is all messed up as well. You would think that when opening the window it would size and position itself based on the the settings. Well this is not the case 100% of the time. When the window is opened the size and positioning is based on how it was on last open. If it is the first open than every thing is fine. But if you open it, move it, change the size then close it on the next open it will look like it did when it was closed. Also, if you change the size of the browser the window will not recenter itself so it is possible you can loose it off the top of the browser.

If anything is corrected with this it should be the caching of the content. Everything else I could live but without better way to handle getting the source this tag is useless to me. I had tons of uses for CFWINDOW. However, I dont think that it was intended to be used in a dynamic environment.

--Dave

Comments
You can have dynamic content in a cfwindow.

ColdFusion.navigate(url, 'cfWindowName_body');
ColdFusion.navigate(url, 'cfWindowName_title');
ColdFusion.Window.show(cfWindowName);
# Posted By todd sharp | 6/5/07 6:34 AM
And how would you expect to be able to bind without a cfform?

If you want variables from an HTML form just use the good old document.getElementById()
# Posted By todd sharp | 6/5/07 6:35 AM
I would consider this a workaround. Like I said, the pure nature of having a source would be to load dynamic content. I should not have to use extra steps like Coldfusion.navigate for something as trivial as loading new content into a window on open.

--Dave
# Posted By Dave | 6/5/07 6:43 AM
Wow are you kidding me?

A workaround? I'd call it an API.

PS - You should also be able to re-center, etc by using ColdFusion.Window.getWindowObject
# Posted By todd sharp | 6/5/07 6:44 AM
@Todd,

Ok, so I redid what I was doing using all JS code and removed the CFWINDOW tag. I now get the functionality I was expecting. However, I still feel that the functionality should be consistent between the tag based and js based syntax. I should not have to use the JS syntax just to get the window to refresh its content.
# Posted By Dave | 6/5/07 7:19 AM
With binding and the tag based syntax you should be able to:

<cfwindow source="myWindow.cfm?foo={myInput@keyup}" />

I know it bloats things a bit but it can be done I believe.
# Posted By todd sharp | 6/5/07 7:29 AM
I am sorry that you come to CF8 expecting to be ticked off. Here's how I responded on your forum post (I assume that you are dave_jf on the forums), just for the record:

"Point taken, Dave. Do note that this is a Beta; the purpose of the Beta is to shake out bugs and problems in the implementation - we are looking for constructive feedback. I've filed an enhancement request filed to get windows to automatically reload when they're shown."
# Posted By Ashwin | 6/5/07 9:53 PM
I did not come to the beta expecting to be ticked off. There is just always something about any new piece of software that just makes you scratch your head. Thank you for putting in the enhancement request. I hope that this is something that can be addressed.

--Dave
# Posted By Dave | 6/6/07 5:33 AM