<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Simple XML: How to call a JavaScript function from the HTML panel? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120375#M6993</link>
    <description>&lt;P&gt;Did you ever find a solution to this? I'm having the same issue.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2015 19:29:07 GMT</pubDate>
    <dc:creator>JoshWhaley</dc:creator>
    <dc:date>2015-07-22T19:29:07Z</dc:date>
    <item>
      <title>Simple XML: How to call a JavaScript function from the HTML panel?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120374#M6992</link>
      <description>&lt;P&gt;I would like to call a JavaScript function defined in &lt;EM&gt;application.js&lt;/EM&gt; when the user clicks a link in a Simple XML dashboard. I have the following code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
   &amp;lt;p&amp;gt;Click on a row in the table to get more information.&amp;lt;/p&amp;gt;

   &amp;lt;p&amp;gt;&amp;lt;a href="javascript:void(0);" onClick="toggleHidden('Explanation');"&amp;gt;Explanation of the data in the table&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This does not work because the parameters of the &lt;EM&gt;a&lt;/EM&gt; tag are stripped. Using Chrome Developer Tools I see that it looks like this when the page has been loaded:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
   &amp;lt;p&amp;gt;Click on a row in the table to get more information.&amp;lt;/p&amp;gt;

   &amp;lt;p&amp;gt;&amp;lt;a href=""&amp;gt;Explanation of the data in the table&amp;lt;/a&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The same code works perfectly when included like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html src="process_detail_explanation.html"&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Is this a bug or by design?&lt;/STRONG&gt; I could not find it documented anywhere.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jan 2015 00:39:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120374#M6992</guid>
      <dc:creator>helge</dc:creator>
      <dc:date>2015-01-28T00:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: How to call a JavaScript function from the HTML panel?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120375#M6993</link>
      <description>&lt;P&gt;Did you ever find a solution to this? I'm having the same issue.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 19:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120375#M6993</guid>
      <dc:creator>JoshWhaley</dc:creator>
      <dc:date>2015-07-22T19:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: How to call a JavaScript function from the HTML panel?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120376#M6994</link>
      <description>&lt;P&gt;Why not add the listener to application.js? &lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 20:23:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120376#M6994</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-22T20:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: How to call a JavaScript function from the HTML panel?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120377#M6995</link>
      <description>&lt;P&gt;This is by design to prevent XSS attacks, and other malicious intents. BUT - there is a way to do this!&lt;/P&gt;

&lt;P&gt;Note : In Splunk 6.X &lt;CODE&gt;application.js&lt;/CODE&gt; is not loaded automatically. Instead, use &lt;CODE&gt;dashboard.js&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require(['jquery'],
function($){
    $('#explanation_control').click(function() {
            $("#Explanation").slideToggle( { direction: 'down'}, 500);
    });
}
 );
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you need to update your &lt;CODE&gt;a&lt;/CODE&gt; to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;a href="#" id="explanation_control"&amp;gt;Explanation of the data in the table&amp;lt;/a&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jul 2015 16:45:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120377#M6995</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-23T16:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: How to call a JavaScript function from the HTML panel?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120378#M6996</link>
      <description>&lt;P&gt;Did this help you? Please accept the answer if so.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 11:54:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-How-to-call-a-JavaScript-function-from-the-HTML-panel/m-p/120378#M6996</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-08-03T11:54:29Z</dc:date>
    </item>
  </channel>
</rss>

