Splunk Enterprise

How do you hide a panel based on a drop-down selection? (Static Options)

UMDTERPS
Communicator

Hi!

I have a drop-down menu that has 3 static options, "Server," "Non-Server," and "All."  

 How do I hide a panel if a user selects "Server" or "Non-Server"?  

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Seems like a misleading error message because you appear to have a *missing* close tag.

    <change>
        <condition label="All">
            <set token="show_panel">1</set>
        </condition>
        <condition label="Server">
            <unset token="show_panel"/> <-- was not closed
        </condition>
        <condition label="Non-Server">
             <unset token="show_panel"/>
        </condition>
      </change>
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Set a token based on the selected drop-down item and make your panel dependent on that token.  See this example stolen from https://docs.splunk.com/Documentation/Splunk/8.0.4/Viz/tokens#Conditional_operations_with_form_input...

<form>
  <label>Just an example</label>
  <fieldset submitButton="false">
    <input type="radio" token="server_tok">
      <label>Select a time range</label>
      <choice value="server">Server</choice>
      <choice value="nonserver">Non-Server</choice>
      <choice value="all">All</choice>
      <default>All</default>

      <change>
        <condition label="Server">
          <set token="show_panel">1</set>
        </condition>
        <condition label="Non-Server">
          <set token="show_panel">1</set>
        </condition>
        <condition label="All">
          <unset token="show_panel"/>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends=$show_panel$>
...

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

UMDTERPS
Communicator

Where does the below XML go in the panel I want to hide? Is the below XML all I need?

 <panel depends=$show_panel$>


For example, this is sample panel code I have of a panel I want to hide, where does the XML go in the XML to hide the panel?

</>OMG, posting is so much different now with the new format. </>

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I thought it was apparent.

<panel depends=$show_panel$>
<title>Servers and Computers</title>
<single>
<search>
<query>|inputlookup data.csv
| search snum = "$system$"
|search rack="$sys$"
| table systrem os rack
| dedup ip
</query>
<earliest>-60m@m</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</single>
</panel>
---
If this reply helps you, Karma would be appreciated.
0 Karma

UMDTERPS
Communicator

Ahh, I see, it has to in the actual panel header. However, the set and unset tagging does the opposite of I want it to do. The panel does not appear when a user selects "All."  I changed the XML to the following, but its giving me an error, "Unexpected close tag"

    <change>
        <condition label="All">
            <set token="show_panel">1</set>
        </condition>
        <condition label="Server">
            <unset token="show_panel">
        </condition>
        <condition label="Non-Server">
             <unset token="show_panel"/>
        </condition>
      </change>

 

 





0 Karma

richgalloway
SplunkTrust
SplunkTrust

Seems like a misleading error message because you appear to have a *missing* close tag.

    <change>
        <condition label="All">
            <set token="show_panel">1</set>
        </condition>
        <condition label="Server">
            <unset token="show_panel"/> <-- was not closed
        </condition>
        <condition label="Non-Server">
             <unset token="show_panel"/>
        </condition>
      </change>
---
If this reply helps you, Karma would be appreciated.

UMDTERPS
Communicator

BOOM! Worked! Thanks! 😃

0 Karma

gstultz_splunk
Splunk Employee
Splunk Employee

If you're familiar with token setting, you can set/unset to view/not view a panel.  Search for this "How can I show/hide panels dynamically with tokens?" posted by "thiagoded" for more details.

0 Karma

gstultz_splunk
Splunk Employee
Splunk Employee

Sorry for a typo..it was posted by "thiagodede".

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Optimize AI at Scale: Must-Attend Observability Sessions at .conf26

conf26   With nearly 70 breakout sessions on the docket, the .conf26 Observability track is designed to help ...

How much can you really learn in 3 minutes?

Observability can certainly be hard to understand – there's a lot of jargon and buzzwords and it seems to ...

Event Series: The Agentic SOC: Trust Before Autonomy

AI is fundamentally changing security operations, but true progress requires more than just automation—it ...