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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...