• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ColdFusion.Window.getWindowObject causes exception on IE

New Here ,
Dec 14, 2007 Dec 14, 2007

Copy link to clipboard

Copied

I am getting the error "Exception Thrown and not caught" on IE7, the code works on Firefox. I have been working on this for more than 8 hours. I need to capture the coordinates of a CFWINDOW so that if the user goes to another page on the site the window can be recreated in the same place. Just put this in any CFM file. (If anyone knows how to fix or a better way of doing it I would be very appreciative). Here is very simple code to reproduce:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title>
<script type="text/javascript">
moveListener = function()
{
if (ColdFusion.Window != null)
{ var w = ColdFusion.Window.getWindowObject('testWindow');
w.on('move',setCoords,w);
}
}

setCoords = function(ob,x,y)
{ alert(x);
}
</script>
</head>
<body onload="javascript:moveListener()">
<CFWINDOW closable="true" initshow="true" name="testWindow">
Test test
</CFWINDOW>
</body>
</html>
TOPICS
Advanced techniques

Views

346

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 14, 2007 Dec 14, 2007

Copy link to clipboard

Copied

LATEST
tested it - saw exception.
tested it in FF with ?cfdebug added to url - saw same exception logged
in the logger.
why the exception? because your cfwindow does not yet exists when your
function tries to access it.
remove the onload=... from the body tag, and add
<cfscript>ajaxOnLoad('moveListener');</cfscript> just before the closing
</body>. worked like a charm for me...

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation