<?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 to create drop-down search inputs in HTML to filter my data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-drop-down-search-inputs-in-HTML-to-filter-my-data/m-p/282536#M85321</link>
    <description>&lt;P&gt;I want to have search inputs/drop downs that can filter out my data similar to this question:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/148500/how-to-set-up-three-dynamic-dropdowns-on-dashboard-in-simple-xml-on-splunk-6-0-1.html"&gt;https://answers.splunk.com/answers/148500/how-to-set-up-three-dynamic-dropdowns-on-dashboard-in-simple-xml-on-splunk-6-0-1.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Is there a way to do this in HTML?&lt;/P&gt;</description>
    <pubDate>Fri, 18 Dec 2015 00:00:36 GMT</pubDate>
    <dc:creator>pmardo</dc:creator>
    <dc:date>2015-12-18T00:00:36Z</dc:date>
    <item>
      <title>How to create drop-down search inputs in HTML to filter my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-drop-down-search-inputs-in-HTML-to-filter-my-data/m-p/282536#M85321</link>
      <description>&lt;P&gt;I want to have search inputs/drop downs that can filter out my data similar to this question:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/148500/how-to-set-up-three-dynamic-dropdowns-on-dashboard-in-simple-xml-on-splunk-6-0-1.html"&gt;https://answers.splunk.com/answers/148500/how-to-set-up-three-dynamic-dropdowns-on-dashboard-in-simple-xml-on-splunk-6-0-1.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Is there a way to do this in HTML?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 00:00:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-drop-down-search-inputs-in-HTML-to-filter-my-data/m-p/282536#M85321</guid>
      <dc:creator>pmardo</dc:creator>
      <dc:date>2015-12-18T00:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to create drop-down search inputs in HTML to filter my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-drop-down-search-inputs-in-HTML-to-filter-my-data/m-p/282537#M85322</link>
      <description>&lt;P&gt;Yes it's possible in HTML. Easiest way is to create it in xml and convert it to html&lt;/P&gt;

&lt;P&gt;Here is an example of adding a dropdown to existing html dashboard.&lt;/P&gt;

&lt;P&gt;Add div tags for the element&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div class="fieldset"&amp;gt;
        &amp;lt;div class="input input-dropdown" id="input1"&amp;gt;
            &amp;lt;label&amp;gt;MyLabel&amp;lt;/label&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Add a search to populate the drop down. You can skip it if you have only static values&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;            var search2 = new SearchManager({
            "id": "search2",
            "latest_time": "now",
            "earliest_time": "-24h@h",
            "cancelOnUnload": true,
            "status_buckets": 0,
            "search": "index=*|stats count by sourcetype",
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "runWhenTimeIsUndefined": false
        }, {tokens: true});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Create the element and add a function to handle dropdown change. Static values can be added in &lt;STRONG&gt;choices&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;         var input1 = new DropdownInput({
            "id": "input1",
            "choices": [
                {"value": "*", "label": "All"}
            ],
            "labelField": "sourcetype",
            "selectFirstChoice": false,
            "default": "*",
            "valueField": "sourcetype",
            "showClearButton": true,
            "searchWhenChanged": true,
            "value": "$form.srctype$",
            "managerid": "search2",
            "el": $('#input1')
        }, {tokens: true}).render();

        input1.on("change", function(newValue) {
            FormUtils.handleValueChange(input1);
        });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you don't have dynamic values &lt;STRONG&gt;managerid&lt;/STRONG&gt; can be removed which has a reference to the previously created search .&lt;/P&gt;

&lt;P&gt;Please refer here for more details : &lt;A href="http://dev.splunk.com/view/webframework-htmldashboards/SP-CAAAETK"&gt;http://dev.splunk.com/view/webframework-htmldashboards/SP-CAAAETK&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Dec 2015 14:11:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-drop-down-search-inputs-in-HTML-to-filter-my-data/m-p/282537#M85322</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-19T14:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create drop-down search inputs in HTML to filter my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-drop-down-search-inputs-in-HTML-to-filter-my-data/m-p/282538#M85323</link>
      <description>&lt;P&gt;I can't seem to get it to filter my data. The drop down lists all the correct data, but I can't seem to filter out information.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;Sample Stat Table: NAME, ID, FavoriteColor&lt;/P&gt;

&lt;P&gt;Data/Inputs in the collection: &lt;BR /&gt;
Abby, 01, Blue&lt;BR /&gt;
Bill, 02, Green&lt;BR /&gt;
Chris, 03, Purple&lt;/P&gt;

&lt;P&gt;My dropdown is searching based on the ID. So when I click my drop down, it lists: 01,02,03. However, if I select 03, it does nothing. Same with all other IDs. Is there something I'm missing?&lt;/P&gt;

&lt;P&gt;I want to be able to list all data based on the ID, even if there are duplicates. &lt;/P&gt;

&lt;P&gt;For example:&lt;BR /&gt;
Abby, 01, Blue&lt;BR /&gt;
Bill, 02, Green&lt;BR /&gt;
Chris, 03, Purple&lt;BR /&gt;
Daniella, 03, Black&lt;/P&gt;

&lt;P&gt;If I search on all IDs with 03, I'll get:&lt;BR /&gt;
Chris, 03, Purple&lt;BR /&gt;
Daniella, 03, Black&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 21:25:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-drop-down-search-inputs-in-HTML-to-filter-my-data/m-p/282538#M85323</guid>
      <dc:creator>pmardo</dc:creator>
      <dc:date>2016-01-04T21:25:55Z</dc:date>
    </item>
  </channel>
</rss>

