|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Check to see if a cfwindow exists
Check to see if a cfwindow exists
When a window gets created by <cfwindow> coldfusion gives it a unique name and not the name you assigned it. I have found a work around in the way of checking for the title of the window as when you create a cfwindow the window title div get the id of yourwinname_title. (code) Example javascript <cfajaximport tags="cfwindow"/> <script language="javascript"> function createphloadwin() { if(document.getElementById('mywindow_title')) { var x = "true"; // Show the window ColdFusion.Window.show("mywindow"); } else { var x = "false"; // Create a new window ColdFusion.Window.create("mywindow", "Upload Photos", "", {height:250,width:400,closable:true,draggable:true,resizable:false,center:true,initshow:true,modal:t rue }) // Put your content in the window or you can assign the url in the ColdFusion.Window.create() document.getElementById('mywindow_body').innerHTML = 'My Window content'; } alert(x); } </script> <a href="javascript:createphloadwin();">Check for window</a> (code/) Good Luck Ben LTS Media Ltd. Thestreamingmonkey |
|
#2
|
||||
|
||||
|
I don't know if CF does things differently when it creates the CFWINDOW, but can't you just use the window_name.close() feature to close it? Then you should also be able to check if window is open with some JS. If (window_name) then windown_name.close; //checks if the window exists, and if it does, it closes it.
__________________
The liver is evil and must be punished! |
|
#3
|
|||
|
|||
|
Cf
Hi Ebot,
thanks for the reply This JS script is to check to see if the cfwindow has been pre-created. As I explained you can't ref a cfwindow by the name assigned to it in the cfwindow tag via JS there is no CFAJAX or CFJS functions to do this. Hence the work around. This has nothing to do with showing and hiding windows there are cf JS functions to do that. If you have an app that creates windows dynamically and you use the cfwindows tag you will end up with a new window every time you hit the same button CF wont destroy and recreate the window. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Check to see if a cfwindow exists |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|