Splunk Search

How to update search bar value when a drop-down value changes?

kevshah
Explorer

I am using following code to display search bar controls on a dashboard. I want to pass a query dynamically into a search bar based on drop-down values selection. (i.e. query in search bar should change whenever drop-down value changes)

 var mysearchbar = new SearchbarView ({
            id: "searchbar1",
            "value": sourcetype.value,
            el: $("#mysearchbar1")
        }, {tokens: true }).render();
0 Karma
1 Solution

sundareshr
Legend

You change change the search property. Here is an example to give an idea

mydropdown.on("change", function(newValue) {
    FormUtils.handleValueChange(mydropdown);
    // build you search string using values from dropdown
    var newsearchstring = "<<your new search string with value from dropdown>>
   mysearchbar.settings.set("value", newsearchstring)
                });

http://docs.splunk.com/Documentation/WebFramework

View solution in original post

sundareshr
Legend

You change change the search property. Here is an example to give an idea

mydropdown.on("change", function(newValue) {
    FormUtils.handleValueChange(mydropdown);
    // build you search string using values from dropdown
    var newsearchstring = "<<your new search string with value from dropdown>>
   mysearchbar.settings.set("value", newsearchstring)
                });

http://docs.splunk.com/Documentation/WebFramework

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...