Jump to content


Javascript error in IE8 (SetReturnValue method)


  • Please log in to reply
7 replies to this topic

#1 atorres

atorres

    Forum Newbie

  • Members
  • 6 posts

Posted 03 June 2010 - 03:44 PM

I am having the same problem, My code works in Chrome and FF but throws an error in IE.



This is the error I am getting:

Line: 1

Error: Object doesn't support this property or method

When I debug with IE i find the error is on this line.

try { document.getElementById("mainChart").SetReturnValue(__flash__toXML(FC_Loaded("mainChart")) ); } catch (e) { document.getElementById("mainChart").SetReturnValue("<undefined/>"); }



I attached my source code perhaps someone can tell me if I'm doing something obviously wrong.





< !doctype html>

< html xmlns=" http://www.w3.org/1999/xhtml" >

< head>

< title> Test< /title>

< script SRC=" /js/fusionCharts/FusionCharts.js" type=" text/javascript" > < /script>

< script SRC=" /js/fusionCharts/FusionChartsExportComponent.js" type=" text/javascript" > < /script>



< /head>

< body>



< a class=" button" href=" javascript:void(0);" onclick=" initiateExport();" > Export/Print Chart< /a>

< br />

< div id=" mainChart" style=" " > The chart will appear within this DIV. This text will be replaced by the chart.< /div>

< script type=" text/javascript" >

var myChart = new FusionCharts(" /charts/FusionCharts/Column3D.swf" , " mainChart" , " 900" , " 300" , " 0" , " 1" );

myChart.setDataXML(" < chart exportEnabled='1'exportShowMenuItem='1'exportAtClient='1' exportHandler='fcExporter1' exportFileName='MyFile' showAboutMenuItem='0' showExportDataMenuItem='1' caption='Monthly Sales Summary' subcaption='For the year 2006' xAxisName='Month' yAxisName='Sales' numberPrefix='$'> < set label='January' value='17400' /> < set label='February' value='19800' /> < set label='March' value='21800' /> < set label='April' value='23800' /> < set label='May' value='29600' /> < set label='June' value='27600' /> < set label='July' value='31800' /> < set label='August' value='39700' /> < set label='September' value='37800' /> < set label='October' value='21900' /> < set label='November' value='32900' /> < set label='December' value='39800' /> < /chart> " );

myChart.render(" mainChart" );

< /script>

< div style=" float:left" id='handlerDivWrapper'>

< div id='exportHandlerDiv'> FusionCharts Export Handler Component< /div>

< /div>

< script type=" text/javascript" >

var fcExportComponent = new FusionChartsExportObject('fcExporter1', '/charts/FusionCharts/FCExporter.swf');

fcExportComponent.sourceCharts = " ['mainChart']" ;

//Full Mode

fcExportComponent.componentAttributes.fullMode = '1';

//Set saving type to individual

fcExportComponent.componentAttributes.saveMode = 'both';

//Show allowed export format drop-down

fcExportComponent.componentAttributes.showAllowedTypes = '1';

//Width and height

fcExportComponent.componentAttributes.width = '350';

fcExportComponent.componentAttributes.height = '250';

//Message - caption of export component

fcExportComponent.componentAttributes.showMessage = '1';

fcExportComponent.componentAttributes.defaultExportFileName = " my_file" ;

fcExportComponent.componentAttributes.message = 'Save file(s) in desired format, then open file to print or attach to email.';

//Render the exporter SWF in our DIV fcexpDiv

fcExportComponent.Render(" exportHandlerDiv" );

function initiateExport(){

fcExportComponent.BeginExportAll();

}

< /script>

< /body>

< /html>




By the way SANATIZE YOUR FORM INPUTS It makes me sick that i had to html encode my source just to post on your site...

#2 atorres

atorres

    Forum Newbie

  • Members
  • 6 posts

Posted 04 June 2010 - 09:20 AM

I figured out the problem...

I basically make sure the div that the javascript is being injected into does not have the same id as the chartId otherwise IE will throw an error.

#3 atorres

atorres

    Forum Newbie

  • Members
  • 6 posts

Posted 04 June 2010 - 09:24 AM

By the way I also recommend adding



//Add wmode transparency to allow overlay

this.addParam('wmode', 'opaque');




to the FusionCharts.js file provided by FC to allow for overlaying any html you may want on top of the chart.

#4 Guest_Basundhara Ghosal_*

Guest_Basundhara Ghosal_*
  • Guests

Posted 07 June 2010 - 01:16 AM

Hi,

Thanks for sharing your idea.

:)


#5 trashCanMan

trashCanMan

    Forum Newbie

  • Members
  • 5 posts

Posted 11 May 2009 - 06:55 AM

Hello,

I am testing IE8 and it is showing the following error:

"Microsoft JScript runtime error: Object doesn't support this property or method"

when executing this code:


try 

{ 

    document.getElementById("graficoCotacoes").SetReturnValue(__flash__toXML(FC_Loaded("graficoCotacoes")) );

} catch (e) 

{ 

    document.getElementById("graficoCotacoes").SetReturnValue("<undefined/>");

 }


I have debugged the javascript code in FusionCharts.js and on line #255 and noticed that on the "if" condition, the instruction
document.embeds[this.getAttribute('id')]
returns 'undefined' and immediately after, the exception is thrown!!!

At the time i wasn´t able to find out where is the bug!

Is this a known problem?



Thank you

Simão Fernandes

Portugal
Simão G. Fernandes

#6 FusionCharts Support

FusionCharts Support

    Supreme Being

  • Members
  • PipPipPipPipPipPipPipPip
  • 2099 posts

Posted 12 May 2009 - 12:54 AM

HI,

Could you please let us know whether you have set registerWithJS option on while rendering the chart.

Please also try running the application from a web server.

Regards,

Sudipto Choudhury
FusionCharts Team

I code, therefore I am.

Follow us on Twitter

#7 dori

dori

    Forum Newbie

  • Members
  • 2 posts

Posted 13 June 2012 - 02:35 PM

The example is very good I used it and created a html link and when i click on it the export is starting
I dont know how to manage to export type (pdf/jpg) is there a way to configure it ?
also after the export finished how can i invoke the save action ?

my goal is to export and save in one click instead of one click for export and another for save

appreciate your help

#8 Sashibhusan

Sashibhusan

    Supreme Being

  • Administrators
  • 934 posts

Posted 14 June 2012 - 10:19 AM

Hi,

With regard to your query, please note that right now FusionCharts does not have the feature of saving the chart image without clicking the "save" button, for Flash Charts.

However you can trigger the capture process automatically immediate after chart renders in browser, by using FusionCharts JavaScript API function "exportChart();".

Ref. Code:
myChart.addEventListener( "rendered" , function ()  { FusionCharts("myChartId").exportChart( { exportAtClient: '0',  exportFormat: 'JPG' } );

Otherwise you can use JavaScript charts for exporting, in which you can export and save the chart in one click.

To see the example of "Exporting JavaScript Charts at client side", please follow the link below:
http://docs.fusionch...criptChart.html

Hope this helps!

Edited by Sashibhusan, 14 June 2012 - 10:20 AM.