Security

form input suggestions (google suggest)

hiddenkirby
Contributor

So i've set up a form dashboard to filter a query displayed in a table.

Is there any way to get a "google suggest" type feature for each of the inputs? like all possible values from the data.

i saw this post and it works for dropdowns. i'd love to figure out how to populate a suggestion box under a text input or something.

http://answers.splunk.com/questions/1891/populate-dropdown-form-field-values-from-a-file

if there is a more hacky approach to custom stuff... i am interested as well.

TIA, Kirby

1 Solution

sideview
SplunkTrust
SplunkTrust

There's a typeahead endpoint that can get suggested search tokens from the index, but there is no module that uses that endpoint besides the big SearchBar module.

As for your question about hacky approaches to custom stuff, disclaimer disclaimer, but it is technically possible to alter the behaviour of any method on any of the module classes from a custom application.js file in your app.

There are three generic text-input modules, FieldSearch, ExtendedFieldSearch and TextSetting. This one would give you the ability to "do something" when there's a keydown event on a FieldSearch module.

if (Splunk.Module.FieldSearch) {
    Splunk.Module.FieldSearch = $.klass(Splunk.Module.FieldSearch, {
        _onKeyDown: function($super, evt) {
            var retVal = $super(result);
            //do something
            return retVal;
        }
    });
}

in this case the something would be get the text content of the input, get the character being added in, make an appropriate jquery request to the typeahead endpoint, binding a js callback function that takes the typeahead data returned and creates a div to put it in and lines it up etc etc.. but that's a lotta handwaving. caveat lector.

View solution in original post

sideview
SplunkTrust
SplunkTrust

There's a typeahead endpoint that can get suggested search tokens from the index, but there is no module that uses that endpoint besides the big SearchBar module.

As for your question about hacky approaches to custom stuff, disclaimer disclaimer, but it is technically possible to alter the behaviour of any method on any of the module classes from a custom application.js file in your app.

There are three generic text-input modules, FieldSearch, ExtendedFieldSearch and TextSetting. This one would give you the ability to "do something" when there's a keydown event on a FieldSearch module.

if (Splunk.Module.FieldSearch) {
    Splunk.Module.FieldSearch = $.klass(Splunk.Module.FieldSearch, {
        _onKeyDown: function($super, evt) {
            var retVal = $super(result);
            //do something
            return retVal;
        }
    });
}

in this case the something would be get the text content of the input, get the character being added in, make an appropriate jquery request to the typeahead endpoint, binding a js callback function that takes the typeahead data returned and creates a div to put it in and lines it up etc etc.. but that's a lotta handwaving. caveat lector.

sideview
SplunkTrust
SplunkTrust

Not simple. jquery will already be there, courtesy of splunk. And I believe only 'application.js' is the only filename it will pick up. No there is essentially no documentation and no examples cause we havent opened up this layer to anyone yet (lack of time and resources)

0 Karma

hiddenkirby
Contributor

Simple as placing jquery.js and mycustom.js in the appserver/static folder? how does it tie into splunk's modules?

0 Karma

hiddenkirby
Contributor

This is great. I would like to accomplish this. Any good documentation on using custom.js or any jquery examples? I don't see anything in the ui-examples app.

0 Karma
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 ...