<?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: xml code to add custom button in dashboard in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490156#M32129</link>
    <description>&lt;P&gt;Then you can add button in dashboard using html.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
      &amp;lt;html&amp;gt;
          &amp;lt;button id="macro" class="btn btn-primary"&amp;gt;Macro&amp;lt;/button&amp;gt;
          &amp;lt;button id="micro" class="btn btn-primary"&amp;gt;Micro&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in js you can implement onclick.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
     "splunkjs/mvc",
     "splunkjs/mvc/simplexml/ready!"
 ], function(mvc) {
     var tokens = mvc.Components.get("default");
  $('#macro').on("click",function(){
         tokens.set("macro", "Macro");
         tokens.unset("micro");
     });
   $('#micro').on("click",function(){
         tokens.set("micro", "Micro");
         tokens.unset("macro");
     });
 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample xml:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;init&amp;gt;
    &amp;lt;set token="macro"&amp;gt;Macro&amp;lt;/set&amp;gt;
    &amp;lt;set token="micro"&amp;gt;Micro&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;label&amp;gt;Label&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
      &amp;lt;html&amp;gt;
          &amp;lt;button id="macro" class="btn btn-primary"&amp;gt;Macro&amp;lt;/button&amp;gt;
          &amp;lt;button id="micro" class="btn btn-primary"&amp;gt;Micro&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row depends="$macro$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Panel Macro&amp;lt;/title&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row depends="$micro$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Panel Micro&amp;lt;/title&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Mar 2020 13:55:33 GMT</pubDate>
    <dc:creator>manjunathmeti</dc:creator>
    <dc:date>2020-03-10T13:55:33Z</dc:date>
    <item>
      <title>xml code to add custom button in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490153#M32126</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;

&lt;P&gt;I want to add a custom button in the dashboard for the following data&lt;/P&gt;

&lt;P&gt;can someone please help me on how to proceed with these as if new to this?&lt;/P&gt;

&lt;P&gt;EXAMPLE DATA:&lt;BR /&gt;
macro&lt;BR /&gt;
micro&lt;BR /&gt;
alpa&lt;/P&gt;

&lt;P&gt;When I click on macro button it should show me the following result:&lt;/P&gt;

&lt;P&gt;RESULT macro:&lt;BR /&gt;
atom&lt;BR /&gt;
electron&lt;/P&gt;

&lt;P&gt;similarly when I click on micro button it should give me only micro result and not macro:&lt;BR /&gt;
RESULT micro:&lt;BR /&gt;
neutron&lt;BR /&gt;
proton&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 11:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490153#M32126</guid>
      <dc:creator>ashwinipatil007</dc:creator>
      <dc:date>2020-03-10T11:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: xml code to add custom button in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490154#M32127</link>
      <description>&lt;P&gt;You can use inbuilt inputs like dropdown or radio buttons.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Label&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="radio" token="field1"&amp;gt;
      &amp;lt;label&amp;gt;Select option:&amp;lt;/label&amp;gt;
      &amp;lt;choice value="macro"&amp;gt;macro&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="micro"&amp;gt;micro&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="alpa"&amp;gt;alpa&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;macro&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$field1$"&amp;gt;
      &amp;lt;title&amp;gt;Panel 1&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;USE $field1$ in your search query.&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Mar 2020 12:47:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490154#M32127</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-10T12:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: xml code to add custom button in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490155#M32128</link>
      <description>&lt;P&gt;I actually want to use  Onclick button , not the radio or dropdown.&lt;BR /&gt;
so is there any piece of code which works for on click button?&lt;/P&gt;

&lt;P&gt;or if can  write it in js or html code kindly let me know&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 12:52:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490155#M32128</guid>
      <dc:creator>ashwinipatil007</dc:creator>
      <dc:date>2020-03-10T12:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: xml code to add custom button in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490156#M32129</link>
      <description>&lt;P&gt;Then you can add button in dashboard using html.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
      &amp;lt;html&amp;gt;
          &amp;lt;button id="macro" class="btn btn-primary"&amp;gt;Macro&amp;lt;/button&amp;gt;
          &amp;lt;button id="micro" class="btn btn-primary"&amp;gt;Micro&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in js you can implement onclick.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
     "splunkjs/mvc",
     "splunkjs/mvc/simplexml/ready!"
 ], function(mvc) {
     var tokens = mvc.Components.get("default");
  $('#macro').on("click",function(){
         tokens.set("macro", "Macro");
         tokens.unset("micro");
     });
   $('#micro').on("click",function(){
         tokens.set("micro", "Micro");
         tokens.unset("macro");
     });
 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample xml:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;init&amp;gt;
    &amp;lt;set token="macro"&amp;gt;Macro&amp;lt;/set&amp;gt;
    &amp;lt;set token="micro"&amp;gt;Micro&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;label&amp;gt;Label&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
      &amp;lt;html&amp;gt;
          &amp;lt;button id="macro" class="btn btn-primary"&amp;gt;Macro&amp;lt;/button&amp;gt;
          &amp;lt;button id="micro" class="btn btn-primary"&amp;gt;Micro&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row depends="$macro$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Panel Macro&amp;lt;/title&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row depends="$micro$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Panel Micro&amp;lt;/title&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Mar 2020 13:55:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490156#M32129</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-10T13:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: xml code to add custom button in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490157#M32130</link>
      <description>&lt;P&gt;appreciate for your quick response :)but thehtml code is not working as expected,when I click on macro it is not showing the title ,similary when I click on micro it is not showing the result.&lt;BR /&gt;
tried with the exact code also which you gave still no luck!&lt;BR /&gt;
tested the function of js script with an alert it is working fine.but not sure of the html and xml code&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 09:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490157#M32130</guid>
      <dc:creator>ashwinipatil007</dc:creator>
      <dc:date>2020-03-11T09:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: xml code to add custom button in dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490158#M32131</link>
      <description>&lt;P&gt;@ashwinipatil007 &lt;BR /&gt;
try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;input type="link" id="submit_button" token="Submit" searchWhenChanged="true" depends="SERVERS"&amp;gt;
            &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
            &amp;lt;choice value="submit"&amp;gt;Submit&amp;lt;/choice&amp;gt;

          &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Style&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;style&amp;gt;
#submit_button label {
              color: #fff701;
              font-size: 12px;
          }
&amp;lt;/style&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Mar 2020 12:10:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/xml-code-to-add-custom-button-in-dashboard/m-p/490158#M32131</guid>
      <dc:creator>DataOrg</dc:creator>
      <dc:date>2020-03-11T12:10:49Z</dc:date>
    </item>
  </channel>
</rss>

