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"?
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>
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$>
...
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. </>
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>
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>
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>
BOOM! Worked! Thanks! 😃
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.
Sorry for a typo..it was posted by "thiagodede".