<?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 How can i stop the java script running when i load the page in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-i-stop-the-java-script-running-when-i-load-the-page/m-p/565701#M46476</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I need to press a button on a dashboard and for it to trigger a .sh script in my APP.&lt;/P&gt;&lt;P&gt;However when I load the page it run the script before I press the button&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard script="run_action.js"&amp;gt;
  &amp;lt;label&amp;gt;Test Action&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;button class="btn btn-primary button1"&amp;gt;Run search!&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/data/apps/splunk/splunk/etc/apps/MxMonitor_MONITORING_MVP_BETA/appserver/static/run_action.js&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
            "jquery",
            "splunkjs/mvc/searchmanager",
            "splunkjs/mvc/simplexml/ready!"
          ], function(
              $,
              SearchManager
          ) {
              var mysearch = new SearchManager({
                  id: "mysearch",
                  autostart: "false",
                  search: "| runshellscript Test_Script123.sh 1 1 1 1 1 1 1 1" 
              });
              $(".button1").on("click", function (){
                  var ok = confirm("Are you sure?");
                  if (ok){
                      mysearch.startSearch();
                      alert('attempted restart!');
                  } //else {
                  //    alert('user did not click ok!');
                  //}
              });
         });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Sep 2021 17:29:48 GMT</pubDate>
    <dc:creator>robertlynch2020</dc:creator>
    <dc:date>2021-09-02T17:29:48Z</dc:date>
    <item>
      <title>How can i stop the java script running when i load the page</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-i-stop-the-java-script-running-when-i-load-the-page/m-p/565701#M46476</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I need to press a button on a dashboard and for it to trigger a .sh script in my APP.&lt;/P&gt;&lt;P&gt;However when I load the page it run the script before I press the button&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard script="run_action.js"&amp;gt;
  &amp;lt;label&amp;gt;Test Action&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;button class="btn btn-primary button1"&amp;gt;Run search!&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/data/apps/splunk/splunk/etc/apps/MxMonitor_MONITORING_MVP_BETA/appserver/static/run_action.js&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
            "jquery",
            "splunkjs/mvc/searchmanager",
            "splunkjs/mvc/simplexml/ready!"
          ], function(
              $,
              SearchManager
          ) {
              var mysearch = new SearchManager({
                  id: "mysearch",
                  autostart: "false",
                  search: "| runshellscript Test_Script123.sh 1 1 1 1 1 1 1 1" 
              });
              $(".button1").on("click", function (){
                  var ok = confirm("Are you sure?");
                  if (ok){
                      mysearch.startSearch();
                      alert('attempted restart!');
                  } //else {
                  //    alert('user did not click ok!');
                  //}
              });
         });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 17:29:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-i-stop-the-java-script-running-when-i-load-the-page/m-p/565701#M46476</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2021-09-02T17:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can i stop the java script running when i load the page</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-i-stop-the-java-script-running-when-i-load-the-page/m-p/565825#M46495</link>
      <description>&lt;P&gt;So this answer&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Dashboards-Visualizations/How-to-disable-search-run-in-js-on-page-load/m-p/565782#M46488" target="_blank"&gt;https://community.splunk.com/t5/Dashboards-Visualizations/How-to-disable-search-run-in-js-on-page-load/m-p/565782#M46488&lt;/A&gt;&lt;/P&gt;&lt;P&gt;by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/165449"&gt;@haph&lt;/a&gt;&amp;nbsp;has gotten me very close , but I just cant finish it&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 15:22:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-i-stop-the-java-script-running-when-i-load-the-page/m-p/565825#M46495</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2021-09-03T15:22:08Z</dc:date>
    </item>
  </channel>
</rss>

