Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


CFCHART adding javascript to JSON

Community Beginner ,
Jun 16, 2016 Jun 16, 2016

Copy link to clipboard

Copied

I recently upgraded from CF9 to CF11 (development version) running on localhost and I am having the following issue. I have a CFC that saves some data, creates a few cfcharts and saves them to disk. The following is getting added to the beginning of the JSON object that is returned to the client, causing the ajax call to fail:

<script type="text/javascript">/* <![CDATA[ */_cf_loadingtexthtml="<img alt=' ' src='/CFIDE/scripts/ajax/resources/cf/images/loading.gif'/>";

_cf_contextpath="";

_cf_ajaxscriptsrc="/CFIDE/scripts/ajax";

_cf_jsonprefix='//';

_cf_websocket_port=8577;

_cf_flash_policy_port=1243;

_cf_clientid='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';/* ]]> */</script><script type="text/javascript" src="/CFIDE/scripts/ajax/messages/cfmessage.js"></script>

<script type="text/javascript" src="/CFIDE/scripts/ajax/package/cfajax.js"></script>

<script type="text/javascript" src="/CFIDE/scripts/chart/cfchart-server.js"></script>

This only happens when I execute the code in the CFC that creates the charts. If I comment that out, it works fine.

Message was edited by: Carl Von Stetten (changed CFGRAPH to CFCHART in title)

Views

770

Likes

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

correct answers 1 Correct answer

Community Beginner , Jun 30, 2016 Jun 30, 2016
My co-worker came up with a work around for this. He suggested that I run the portion of the code that generates the charts in a separate thread and that seems to work. I assume that whatever was triggering CF to prepend the return data was bypassed by doing this.

Likes

Translate

Translate
Adobe Community Professional ,
Jun 19, 2016 Jun 19, 2016

Copy link to clipboard

Copied

That is so by design. ColdFusion includes those built-in scripts to render its user interfaces.  However, we're talking about UIs such as cfchart, not cfgraph. You should not be using the cfgraph tag, as it was deprecated many years ago, even before Coldfusion MX 6.

In fact, you should avoid using any ColdFusion UIs altogether. Plan to replace them with modern alternatives.

Likes

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
Community Beginner ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

I wrote cfgraph in the title by mistake,  I am using cfchart as indicated in the text where I said I was creating a few cfcharts.

Likes

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
Community Beginner ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

This behavior was not an issue with my CF9 install, only since I upgraded to CF11.

Likes

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
Adobe Community Professional ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

Something perhaps went wrong during the upgrade to ColdFusion 11. ColdFusion versions 8 and 9 had a different charting engine (webCharts3D) from that of Coldfusion 11 (ZingCharts).

Could you show us the CFC code? If it is to save chart data to disk, then there should be no reason for the above Javascript to be sent to the client.

A workaround might be to run the CFC code later on in the page, after all regular AJAX calls have run.

Might also be a good idea to install the latest Coldfusion 11 Hot Fix. You may be suffering from a bug that has been fixed.

Likes

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 ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

Best practice is what you already stated, BKBK​; stop using CF UI altogether and use modern (current, more secure, faster) alternatives.

Just my two cents.

V/r,

^_^

(PS - if kevinn is using CFFORM, get rid of it, too.  Waste of resources.)

Likes

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
Community Beginner ,
Jun 23, 2016 Jun 23, 2016

Copy link to clipboard

Copied

Only using cfchart, I have never used cfform, nor would I.

Likes

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 ,
Jun 23, 2016 Jun 23, 2016

Copy link to clipboard

Copied

Glad to hear that.  I inherited a bunch of legacy apps/sites where the previous lead developer couldn't use enough CFFORM.  He used it for _every_ form-required situation.  It's taking forever to undo that rabbit-hole.  **headdesk**  **headdesk**  **headdesk**

V/r,

^_^

Likes

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
Community Beginner ,
Jun 30, 2016 Jun 30, 2016

Copy link to clipboard

Copied

My co-worker came up with a work around for this. He suggested that I run the portion of the code that generates the charts in a separate thread and that seems to work. I assume that whatever was triggering CF to prepend the return data was bypassed by doing this.

Likes

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
Adobe Community Professional ,
Jun 30, 2016 Jun 30, 2016

Copy link to clipboard

Copied

Kevin35399675, thanks for sharing that. Please mark it as the correct answer.

Likes

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 ,
Jun 30, 2016 Jun 30, 2016

Copy link to clipboard

Copied

LATEST

Working with CFTHREAD is something I really, really need to start learning.

V/r,

^_^

Likes

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