<?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 Simple XML strips onclick from HTML button in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255315#M29366</link>
    <description>&lt;P&gt;I am trying to do an onclick in a button in an HTML block in Simple XML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;
&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Test Button onclick error&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;button id="button" onclick="myfunction()" rover="dog"&amp;gt;Click Here&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&amp;lt;/code&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When it gets rendered, onclick is removed.  Noticed I added a bogus tag and it was passed through.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;
    &amp;lt;div id="row1" class="dashboard-row dashboard-row1"&amp;gt;
        &amp;lt;div id="panel1" class="dashboard-cell" style="width: 100%;"&amp;gt;
            &amp;lt;div class="dashboard-panel clearfix"&amp;gt;

                &amp;lt;div class="panel-element-row"&amp;gt;
                    &amp;lt;div id="element1" class="dashboard-element html" style="width: 100%"&amp;gt;
                        &amp;lt;div class="panel-body html"&amp;gt;
                                &amp;lt;div&amp;gt;&amp;lt;button id="button" rover="dog"&amp;gt;Click Here&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/code&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying to execute a java script on demand from a link in an HTML panel.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Mon, 21 Mar 2016 13:27:20 GMT</pubDate>
    <dc:creator>fk319</dc:creator>
    <dc:date>2016-03-21T13:27:20Z</dc:date>
    <item>
      <title>Simple XML strips onclick from HTML button</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255315#M29366</link>
      <description>&lt;P&gt;I am trying to do an onclick in a button in an HTML block in Simple XML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;
&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Test Button onclick error&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;button id="button" onclick="myfunction()" rover="dog"&amp;gt;Click Here&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&amp;lt;/code&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When it gets rendered, onclick is removed.  Noticed I added a bogus tag and it was passed through.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;
    &amp;lt;div id="row1" class="dashboard-row dashboard-row1"&amp;gt;
        &amp;lt;div id="panel1" class="dashboard-cell" style="width: 100%;"&amp;gt;
            &amp;lt;div class="dashboard-panel clearfix"&amp;gt;

                &amp;lt;div class="panel-element-row"&amp;gt;
                    &amp;lt;div id="element1" class="dashboard-element html" style="width: 100%"&amp;gt;
                        &amp;lt;div class="panel-body html"&amp;gt;
                                &amp;lt;div&amp;gt;&amp;lt;button id="button" rover="dog"&amp;gt;Click Here&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/code&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying to execute a java script on demand from a link in an HTML panel.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 13:27:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255315#M29366</guid>
      <dc:creator>fk319</dc:creator>
      <dc:date>2016-03-21T13:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML strips onclick from HTML button</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255316#M29367</link>
      <description>&lt;P&gt;I worked:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/378289/calling-java-script-from-dashboard.html"&gt;https://answers.splunk.com/answers/378289/calling-java-script-from-dashboard.html&lt;/A&gt;&lt;BR /&gt;
and &lt;BR /&gt;
&lt;A href="http://www.w3schools.com/jquery/event_on.asp"&gt;http://www.w3schools.com/jquery/event_on.asp&lt;/A&gt;&lt;BR /&gt;
but was unable to get anything to work.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 15:52:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255316#M29367</guid>
      <dc:creator>fk319</dc:creator>
      <dc:date>2016-03-24T15:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML strips onclick from HTML button</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255317#M29368</link>
      <description>&lt;P&gt;Try removing the Bootstrip &lt;CODE&gt;div&lt;/CODE&gt; elements wrapping your submit button, replacing with a plain &lt;CODE&gt;div&lt;/CODE&gt;, and sourcing your JavaScript from a &lt;CODE&gt;.js&lt;/CODE&gt; file -- I was using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div class="control-group"&amp;gt;
    &amp;lt;div class="controls"&amp;gt;
        &amp;lt;input id="submit_button" type="button" value="Click" onclick="alert('Test')" /&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and replaced it with&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;dashboard.xml&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input id="submit_button" type="button" value="Click"/&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;dashboard.js&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([ "jquery", "splunkjs/mvc/simplexml/ready!"],
         function($){
            $("#submit_button").on("click", function (){
                 alert("Test");
            });
         });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure &lt;EM&gt;why&lt;/EM&gt; SimpleXML chomps the onclick, but this workaround helped.&lt;/P&gt;

&lt;P&gt;Source: &lt;A href="https://answers.splunk.com/answers/378289/calling-java-script-from-dashboard.html"&gt;https://answers.splunk.com/answers/378289/calling-java-script-from-dashboard.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 29 May 2016 20:40:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255317#M29368</guid>
      <dc:creator>rlacher1</dc:creator>
      <dc:date>2016-05-29T20:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML strips onclick from HTML button</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255318#M29369</link>
      <description>&lt;P&gt;@fk319 try removing any Bootstrap divs surrounding the input -- that was what fixed my issue while using your first link.&lt;/P&gt;</description>
      <pubDate>Sun, 29 May 2016 20:44:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255318#M29369</guid>
      <dc:creator>rlacher1</dc:creator>
      <dc:date>2016-05-29T20:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML strips onclick from HTML button</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255319#M29370</link>
      <description>&lt;P&gt;this is not working with default submit button (field set) , any suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 23:19:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Simple-XML-strips-onclick-from-HTML-button/m-p/255319#M29370</guid>
      <dc:creator>jossplacencia</dc:creator>
      <dc:date>2017-01-04T23:19:05Z</dc:date>
    </item>
  </channel>
</rss>

