Sign in to follow this  
wbdvlpr

Calling javascript functions ..

Recommended Posts

hi

 

we set javascript links in charts (for drill down) as ..

 

$strXML .= " set label='" . $ors['name'] . "' value='" . $ors['numVal'] . "' link='javaScript:updateChart2(" . $ors['catid'] . ")' ";

 

 

 

Is it possible to call 2 functions with one click? can we set 2 functions like "link=javascript:func1();func2()".

 

please guide me to correct way.

 

 

 

PS: I can call func2() within func1().. but want to set it on the click.

 

Thanks,

 

Cj

Share this post


Link to post
Share on other sites

I am trying to call a javascript function and am having some difficulties.

 

 

 

The call should look like:

 

a href="javascript:void loadTab('div_name','link')"

 

 

 

The problem is the apostrophe's when I pass the variables to loadTab. I tried URLENCODING them and doing different things but it keeps saying invalid XML. Even when I use " and try escaping them " it still doesn't work.

 

 

 

Here are my calls with URLENCODE and without:

 

 

 

WITH:

 

javascript:void loadTab('chart_point_info','http://localhost/Test/Show/1017/')

 

 

 

I get an error message of "Invalid XML Data". My debug message is:

 

 

 

INFO: XML Data provided using dataXML method.

 

INFO: XML Data provided using dataXML method.

 

ERROR: Invalid XML encountered. An XML element is malformed. Check the XML data that you've provided. If you've special characters in your XML (like %, &, ' or accented characters), please URL Encode them.

 

 

 

WITHOUT:

 

javascript%3Avoid+loadTab%28%27chart_point_info%27%2C%27http%3A%2F%2Flocalhost%2FTest%2FShow%2F1017%2F%27%29

 

 

 

Same error message as above.

 

 

 

 

 

Any help on how to call this javascript function would be greatly appreciated.

 

 

 

Thanks.

 

 

 

[uPDATE]

 

I should also say that I am calling the data using setDataXML. I believe that is why I am having issues with the apostrophe and quotes.

Edited by Guest

Share this post


Link to post
Share on other sites

Hi,

Could you please provide us XML? Here you calling link with <a href=''> link. This link will not work with in XML. Also you are using wrong java script call. Correct code is

<a href="javascript:loadTab('div_name','link')" > no [void].

If you want this link work for chart XML then Please use link attribute with in <set>

e.i.

in DataURL method

<set value='100' link='javascript:loadTab('div_name' , 'link' )' />

in DataXML method

<set value='100' link='javascript:loadTab(%25apos;div_name' , %25apos;link' )' />

 

 

 

Edited by Guest

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
Sign in to follow this