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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...