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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...