Splunk Search

How to customize panel popup based on checkboxes?

mahesh27
Path Finder

I have few checkboxes where my panels are getting displayed when i select them and if i unselct them they are not appearing , till hear i am good but my requirement is

under mainframe i have 2 checkboxes source and destination
under services i have 6 checkboxes service1, service2......
under items  i have 4 checkboxes item1, item2....

So here ,
service1, service2 and service 3, item1, item 2 belongs to source
service4, service5 and service 6, item3, item 4 belongs to destination

So my panels should display when i select source, service1, item1 check box only.

Main frame         services         items     
 
source                     service1      item1
destination           service2       item2
                                   service3      item3
                                   service4      item4
                                   service5      
                                   service6

How can i do that?????

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

You need two elements:

  • Populate (set and unset) a dedicated token to control that panel, perhaps in <condition><set token/></condition> blocks in <input/> or <init/>. (If inside <input />, see Define tokens for conditional operations with form inputs.)
  • Use that token as values for "depends" attribute of the display element.

See Show or hide content.  Actual coding takes some practice.  There are many examples in this forum, too.

0 Karma

mahesh27
Path Finder

so here is my code, can u help me on this:
<form>
<label></label>
<fieldset submitbutton="false">
<input type="checkbox"  token="check" searchwhenchanged=true>
<label>source details</label>
<choice value=sourcetype=afv OR sourcetype=afv ght OR sourcetype=afv jhy> source</choice>
<choice value=sourcetype=aaa OR sourcetype=aaabgth OR sourcetype=aaajuk> destination</choice>
<change>
<condition match =$check$ == *afv*>
<set token=src>1</set>
<unset token=dst></unset>
</condition>
<condition match =$check$ == *aaa*>
<set token=dst>1</set>
<unset token=src></unset>
</condition>
<condition match =$check$ == *afv*>
<set token=src>1</set>
<set token=dst>1</set>
</condition>
</change>
<row>
<panel depends="$src$">
<title></tilte>
<search>
<query>.....</query>
</form>

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Just make sure you open and close XML tags properly, and note that some special characters must be represented as HTML entities; e.g., quotation mark (") must be represented as &quot;.

This is a test dashboard based on your code to play with.

<form version="1.1">
  <label>test hiding</label>
  <description></description>
  <search>
    <query>.....</query>
  </search>
  <fieldset>
    <input type="checkbox" token="check" searchWhenChanged="true">
      <label>check</label>
      <choice value="sourcetype=&quot;afv&quot; OR sourcetype=&quot;afv ght&quot; OR sourcetype=&quot;afv jhy&quot;">source</choice>
      <choice value="sourcetype=&quot;aaa&quot; OR sourcetype=&quot;aaabgth&quot; OR sourcetype=&quot;aaajuk&quot;">destination</choice>
      <change>
        <condition match="match($check$, &quot;afv&quot;)">
          <set token="src">1</set>
          <unset token="dst"></unset>
        </condition>
        <condition match="match($check$, &quot;aaa&quot;)">
          <set token="dst">1</set>
          <unset token="src"></unset>
        </condition>
        <condition match="$check$ == &quot;*afv*&quot;">
          <set token="src">1</set>
          <set token="dst">1</set>
        </condition>
      </change>
      <delimiter> </delimiter>
    </input>
  </fieldset>
  <row>
    <panel depends="$src$">
      <html>
        <p>test</p>
        <br>check: $check$</br>
      </html>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

Index This | A sphere has three, a circle has two, and a point has zero. What is it?

September 2023 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

Build Scalable Security While Moving to Cloud - Guide From Clayton Homes

 Clayton Homes faced the increased challenge of strengthening their security posture as they went through ...

Mission Control | Explore the latest release of Splunk Mission Control (2.3)

We’re happy to announce the release of Mission Control 2.3 which includes several new and exciting features ...