Dashboards & Visualizations

Panels not waiting on Submit button

Satyapv
Engager

Hello,

I have below code for a dropdown menu and the problem is the moment i select any of the value from drop down dependent panels load without waiting for Submit button. How can this be fixed.

Submit Button code:

<fieldset submitButton="true" autoRun="false">
<input token="field1" type="time" searchWhenChanged="false">
<label>Time Picker</label>
<default>
<earliest>-15m</earliest>
<latest>now</latest>
</default>
</input>

Dropdown and Token

<input type="dropdown" token="subsummary" depends="$loadsummary$" searchWhenChanged="false">
<label>Summary Selection</label>
<choice value="FUNC">Function Summary</choice>
<choice value="MQ">MQ Summary</choice>
<change>
<condition value="FUNC">
<set token="funcsummary">true</set>
<unset token="funcsummaryMQ"></unset>
</condition>
<condition value="MQ">
<set token="funcsummaryMQ">true</set>
<unset token="funcsummary"></unset>
</condition>
</change>

 

Sample Panel:

<row depends="$funcsummaryMQ$">
<panel depends="$funcsummaryMQ$">
<title>ABC</title>
<table>
<search >
<query>index="SAMPLE" </query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="wrap">true</option>
</table>
</panel>
</row>

0 Karma

bowesmana
SplunkTrust
SplunkTrust

The problem is because you are using a change block which is run always and not on the submit button, so you are setting the token dependencies when you change the dropdown.

You need to do it a bit differently, so that a search is run based when the submit button is clicked and that search has a <done> clause that will set/unset the panel triggers to show/hide the panels. Note that it uses eval statements to cause the tokens to be set/unset.

See this

<form>
  <label>Submit</label>
  <init>
    <set token="loadsummary"></set>
  </init>
  <fieldset submitButton="true" autoRun="false">
    <input token="field1" type="time" searchWhenChanged="false">
      <label>Time Picker</label>
      <default>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="dropdown" token="subsummary" depends="$loadsummary$" searchWhenChanged="false">
      <label>Summary Selection</label>
      <choice value="FUNC">Function Summary</choice>
      <choice value="MQ">MQ Summary</choice>
    </input>
  </fieldset>
  <row depends="$funcsummaryMQ$">
    <panel depends="$funcsummaryMQ$">
      <title>ABC</title>
      <table>
        <search>
          <query>index="SAMPLE" </query>
        </search>
        <option name="count">100</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="refresh.display">progressbar</option>
        <option name="rowNumbers">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
  <row depends="$hidden$">
    <panel>
      <table>
        <search>
          <query>
            | makeresults
            | eval ss=$subsummary|s$
          </query>
          <done>
            <eval token="funcsummary">if($result.ss$="FUNC","true",null())</eval>
            <eval token="funcsummaryMQ">if($result.ss$="MQ","true",null())</eval>
          </done>
        </search>
      </table>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

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

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...