anila

Need to call js function on entire chart.

Recommended Posts

Hi,

I used like this in my jsp.

<chart labelDisplay='Rotate'  slantLabels='1'  connectNullData='1'  baseFont='Ge Inspira'  useRoundEdges='1' legendPosition='RIGHT'  yAxisName='NPS' legendBorderAlpha='0' shownames='1' showvalues='0' clickURL='download('DwnNPS',2)'>

by puting javascript function in head tag in same page.

<script language="javascript">
 function download(feed,ctl){
   var form  = document.forms[0];
	   form.method="POST";
   form.action="ExtDXAction.do?type="+feed+"&cn="+ctl;
   form.submit();
 }
 </script>

it is showing invalid xml data.

If i remove the single quote,its not throwing exception.

but i have to pass the string to call the js function.:P

may i know where i did the mistake.

is it possible to call external js file.

Share this post


Link to post
Share on other sites

Hi,

here is my xml file.

<chart caption='Trend By Region-USA' baseFont='Ge Inspira' legendPosition='RIGHT' clickURL='j-download('DwnNPS',2)' yAxisName='NPS' legendBorderAlpha='0' shownames='1' showvalues='0' ><categories><category label='Jul-2008'/><category label='Aug-2008'/><category label='Sep-2008'/><category label='Oct-2008'/><category label='Nov-2008'/><category label='Dec-2008'/><category label='Mar-2009'/><category label='Jun-2009'/></categories><dataset seriesName='Central Corridor'><set value='67.0'/><set value='80.0'/><set value='45.0'/><set value='75.0'/><set value='64.0'/><set value='65.0'/><set value='80.0'/><set value='73.0'/></dataset><dataset seriesName='West'><set value='65.0'/><set value='61.0'/><set value='45.0'/><set value='62.0'/><set value='77.0'/><set value='77.0'/><set value='79.0'/><set value='52.0'/></dataset><dataset seriesName='Ultrasound HQ'><set value='100.0'/></dataset><dataset seriesName='North East'><set value='77.0'/><set value='77.0'/><set value='55.0'/><set value='62.0'/><set value='76.0'/><set value='73.0'/><set value='78.0'/><set value='77.0'/></dataset><dataset seriesName='Central Atlantic'><set value='86.0'/><set value='76.0'/><set value='54.0'/><set value='74.0'/><set value='88.0'/><set value='78.0'/><set value='80.0'/><set value='69.0'/></dataset><dataset seriesName='South East'><set value='65.0'/><set value='75.0'/><set value='72.0'/><set value='87.0'/><set value='85.0'/><set value='84.0'/><set value='76.0'/><set value='81.0'/></dataset></chart>

Script function is

<script language="javascript">
		  function download(feed,ctl){
   var form  = document.forms[0];
	   form.method="POST";
   form.action="ExtDXAction.do?type="+feed+"&cn="+ctl;
   form.submit();
 }

Shall i place ths script as part of external script file?

Let me know what is going wrong.

Waiting for ur reply..........

Share this post


Link to post
Share on other sites
Guest Madhumita

Hi Anila,

Can you please consider changing clickURL='j-download('DwnNPS',2) to the following?

clickURL='j-download-DwnNPS-2'

 

Hope this helps.

Share this post


Link to post
Share on other sites
Guest Madhumita

Hi Anila,

 

 

 

The error occurring might be because of the DwnNPS function.

 

 

 

Can you please send us the code for the DwnNPS , so that we can possibly find a solution.

 

 

 

Awaiting your reply.

Share this post


Link to post
Share on other sites

Hi,

 

 

 

Could you please try one of the following?

 

 

 

Java Scrip t:download('DwnNPS',2)

 

 

 

 

 

or

 

 

 

 

 

j-download-DwnNPS,2

 

 

 

[ Here the function download will get one parameter string "DwnNPS,2" which you need to split into to in the function itself.]

Share this post


Link to post
Share on other sites

Hi Sudipto Choudhury,

Thanks for your reply.

<chart labelDisplay='Rotate' slantLabels='1' clickURL=JavaScript:download('DwnNPS',2) baseFont='Ge Inspira' useRoundEdges='1' legendPosition='RIGHT'  yAxisName='NPS' legendBorderAlpha='0' shownames='1' showvalues='0' >

I was calling js function as part chart tag as shown above.

It is throwing javascript error like:Expected ')'

May i know wats wrong about this.

Thanks in advance.

Smiles,

Anitha G

Share this post


Link to post
Share on other sites

Hi,

I find in your XML:

clickURL=download('DwnNPS',2)

This is not a valid XML attribute. You need to use single/double quote around the values.

clickURL="download('DwnNPS',2);"

This would help. Make sure that you are using DataURL method.

If you are using dataXML method please use:

clickURL='download(%26apos;DwnNPS%26apos;,2);'

Share this post


Link to post
Share on other sites

Hi,

by using like this clickURL='download(%26apos;DwnNPS%26apos;,2);' ,it will work similar like js function onclick?

I tried this one also it is redirecting

http://localhost:8084/project_Testing_FS/download('DwnNPS',4); like this.

type Status report

message /project_Testing_FS/download('DwnNPS',4);

description The requested resource (/project_Testing_FS/download('DwnNPS',4):P is not available.

wat else i have to do here?

Any thing wrong i did???

Share this post


Link to post
Share on other sites

Hi,

Thanks for your reply.

Here is the code

String chartXML1 = "<chart connectNullData='1' labelDisplay='Rotate' slantLabels='1' baseFont='Ge Inspira' useRoundEdges='1' legendPosition='RIGHT' yAxisName='NPS' legendBorderAlpha='0' shownames='1' showvalues='0' clickURL='download(%26apos;DwnNPS%26apos;,4);'>";  

 

Share this post


Link to post
Share on other sites

Hi Anila,

Please change that statement with:

String chartXML1 = "<chart connectNullData='1' labelDisplay='Rotate' slantLabels='1' baseFont='Ge Inspira' useRoundEdges='1' legendPosition='RIGHT' yAxisName='NPS' legendBorderAlpha='0' shownames='1' showvalues='0' clickURL='download(%26apos;DwnNPS%26apos;,4);'>"; 

Hope this works!

Share this post


Link to post
Share on other sites

Hi,

Thanks for your reply.

After replacing with your statement also,it did n't worked.

I am wondering wat is the difference between yours statement and mine.

Same error i am getting in IE.

Share this post


Link to post
Share on other sites

Hi Anila

 

2nd Method:

 

Please use the following code and try again?

 

String chartXML1 = "<CHART clickURL='j-download-DwnNPS,4' showvalues='0' shownames='1' legendBorderAlpha='0' yAxisName='NPS' legendPosition='RIGHT' useRoundEdges='1' baseFont='Ge Inspira' slantLabels='1' labelDisplay='Rotate' connectNullData='1'>";

 

and later in you JavaScript, you would need to split the parameter using delimiter as , (comma). Also please make sure that you have set registerWithJS parameter to true.

Edited by Guest

Share this post


Link to post
Share on other sites

Hi Rahul,

It is throwing javascript error:unterminated string constant.

String chartXML1 = "<chart clickURL='j-download-DwnNPS,4' labelDisplay='Rotate' slantLabels='1' baseFont='Ge Inspira' useRoundEdges='1' legendPosition='RIGHT' yAxisName='NPS' legendBorderAlpha='0' shownames='1' showvalues='0'>"; 

Let me know wats wrong going here....

Share this post


Link to post
Share on other sites

Hi Anila,

 

 

 

Could you please post your code for your JS function 'download' ?

 

 

 

Also please attached the HTML Generated code of your JSP page (by going to View Source of the page).

Share this post


Link to post
Share on other sites

Hi Rahul,

it is throwing

HTTP Status 404 - /project_Testing_FS/j-download-DwnNPS,4


type Status report

message /project_Testing_FS/j-download-DwnNPS,4

description The requested resource (/project_Testing_FS/j-download-DwnNPS,4) is not available.


Apache Tomcat/5.5.9

Share this post


Link to post
Share on other sites

Hi Srividya,

hey your function is working,but its working only first time click.

what is the problem,usually it will work like this only...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now