All Apps and Add-ons

How do I prevent search from running until user presses Submit

DaveO35
Explorer

I'm working on a dashboard that will present the user with a chart after selecting some fields from a couple dynamically populated Pulldowns and pressing the submit button.

I wrote up a simple version of this based on a Sideview example page. Basically, there is a search run to populate the Pulldown, then a Button. When the button is pressed I would like the search to run and display the results. Right now, it runs the second search and displays results before the user can select something.

Here is my sample code (based on the dynamic Pulldown example from the SV documentation).

What am I missing to prevent the second search from running?

<module name="Search" layoutPanel="panel_row1_col1" autoRun="True">
<param name="search">index=_internal source="*metrics.log" group="per_sourcetype_thruput" | dedup series | sort series | fields series</param>
<param name="earliest">-1h</param>
<param name="latest">now</param>

<module name="Pulldown">
    <param name="name">selectedSourcetypeSearchTerm</param>
    <param name="label">filter:</param>
    <param name="template">series="$value$"</param>
    <param name="searchFieldsToDisplay">
        <list>
            <param name="label">series</param>
            <param name="value">series</param>
        </list>
    </param>
    <module name="Button">
        <param name="allowSoftSubmit">False</param>
        <param name="allowAutoSubmit">False</param>
        <param name="label">Go</param>


        <module name="Search">
            <param name="search">index=_internal source="*metrics.log" group="per_sourcetype_thruput" $selectedSourcetypeSearchTerm$ | stats min(eps) avg(eps) max(eps) </param>
            <param name="earliest">-1h</param>
            <param name="latest">now</param>

            <module name="SimpleResultsTable">
                <param name="displayRowNumbers">False</param>
                <param name="entityName">results</param>
            </module>
        </module>
    </module>
</module>

Thanks in advance.

1 Solution

sideview
SplunkTrust
SplunkTrust

Unfortunately, although the Button module has an 'allowAutoSubmit' param, it was never implemented. I apologize for that - I added that parameter during some prototyping, later reverted the code but forgot to revert the param, so it shipped... I've added an implementation for it in the new version of Sideview Utils (1.2.5), which will launch in a day or two.

However, even after this works for you, the real source of confusion for the end-user, is the limbo this leaves all the elements below.

So in practice, if you set allowAutoSubmit to false, you'll still probably want to use application.js to define a customBehavior for the SubmitButton, so that it hides all the modules and panels below until the user clicks the Button. I'll try and add some documentation for this in the new version as well.

View solution in original post

sideview
SplunkTrust
SplunkTrust

Unfortunately, although the Button module has an 'allowAutoSubmit' param, it was never implemented. I apologize for that - I added that parameter during some prototyping, later reverted the code but forgot to revert the param, so it shipped... I've added an implementation for it in the new version of Sideview Utils (1.2.5), which will launch in a day or two.

However, even after this works for you, the real source of confusion for the end-user, is the limbo this leaves all the elements below.

So in practice, if you set allowAutoSubmit to false, you'll still probably want to use application.js to define a customBehavior for the SubmitButton, so that it hides all the modules and panels below until the user clicks the Button. I'll try and add some documentation for this in the new version as well.

sideview
SplunkTrust
SplunkTrust

No, there wasn't an issue with Sideview Utils 1.2.5, but there were a lot of issues with Splunkbase over the last week and to make a long story short the best overall workaround while they were being fixed was for me to delete the 1.2.5 release. It's back now. Sorry about the inconvenience.

0 Karma

DaveO35
Explorer

Where did 1.2.5 go? is there an issue with it. I can't find it here now, it says 1.2.4 is newest.

0 Karma

sideview
SplunkTrust
SplunkTrust

I put one such customBehavior into Sideview Utils, and it's wired up to a secret view called "testcases_for_textfield". You can see the customBehavior implementation in Sideview Utils' application.js, lines 165 - 178.

0 Karma

DaveO35
Explorer

Thanks Nick, I updated sideview to 1.2.5 and it works as expected.

I see what you mean about the elements below. I might have to look into the custom behavior at a later date.

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