I ran accross a noteworthy question on Experts-Exchange today regarding a javascript error that occurs when you have a cflayout that navigates to a page with a cfchart tag.

The setup is that the main page (home.cfm) has cflayoutareas and one of them has a link that navigates to chart.cfm targeting a specific layout area.

home.cfm:

<cflayout type="border" name="layoutborder">
<cflayoutarea name="Center" position="center">
<a href="#" onclick="ColdFusion.navigate('chart.cfm','Center')">chart</a>
</cflayoutarea>
</cflayout>

chart.cfm:

<cfchart>
<cfchartseries type="line" serieslabel="2008">
<cfchartdata item="January" value="100">
</cfchartseries>
</cfchart>

If you run chart.cfm by itself the chart shows up, but if you rund the main page code you an generic error "Error processing javascript in markup". It seems cfchart doesnt work when linked to via Coldfusion.navigate from a cflayout area.

This error does not pop up in FireFox, but I was able to duplicate it in IE. The solution to is to add a script tag to import the /CFIDE/scripts/CF_RunActiveContent.js file in the main page like this:

home.cfm:

<script type="text/javascript" charset='utf-8' src='/CFIDE/scripts/CF_RunActiveContent.js'></script>
<cflayout type="border" name="layoutborder">
<cflayoutarea name="Center" position="center">
<a href="#" onclick="ColdFusion.navigate('chart.cfm','Center')">chart</a>
</cflayoutarea>
</cflayout>

Comments
Rand's Gravatar Thanks for the tip!
# Posted By Rand | 3/25/08 4:45 PM
 
Home | Blog | Portfolio | Contact | © 2001 - 2007 The ColdFusion Guy - Scott Bennett. All rights reserved.
BlogCFC was created by Raymond Camden. This blog is running version 5.9.