Dashboards & Visualizations

When one checkbox is selected, the others are unchecked

ViniciusMariano
Explorer

Hello folks,

 I have a question about multiple checkbox, I'm using them to fill a "IN" command in my search and I have an "All option" and I was thinking if is it possible when I check this "All option"  the others will be unchecked like in this example below:

1:

ViniciusMariano_0-1695904399399.png 

2:

ViniciusMariano_2-1695904503510.png

and if possible only using XML (without JavaScript).

 

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Probably because you didn't say you wanted "*" and you are probably missing some backslashes - try this

    <input type="checkbox" token="checkbox" id="checkABC">
      <label></label>
      <choice value="*">All</choice>
      <choice value="AA">AA</choice>
      <choice value="BB">BB</choice>
      <choice value="CC">CC</choice>
      <change>
        <condition match="match($checkbox$,&quot;\\*&quot;)">
          <unset token="A"></unset>
          <unset token="B"></unset>
          <unset token="C"></unset>
          <set token="form.checkbox">*</set>
        </condition>
        <condition>
          <eval token="A">if(match($checkbox$,"AA"),"A",null())</eval>
          <eval token="B">if(match($checkbox$,"BB"),"B",null())</eval>
          <eval token="C">if(match($checkbox$,"CC"),"C",null())</eval>
        </condition>
      </change>
      <default>AA,BB,CC</default>
      <initialValue>AA,BB,CC</initialValue>
      <delimiter>,</delimiter>
    </input>

 

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

    <input type="checkbox" token="checkbox" id="checkABC">
      <label></label>
      <choice value="All">All</choice>
      <choice value="AA">AA</choice>
      <choice value="BB">BB</choice>
      <choice value="CC">CC</choice>
      <change>
        <condition match="match($checkbox$,&quot;All&quot;)">
          <unset token="A"></unset>
          <unset token="B"></unset>
          <unset token="C"></unset>
          <set token="form.checkbox">All</set>
        </condition>
        <condition>
          <eval token="A">if(match($checkbox$,"AA"),"A",null())</eval>
          <eval token="B">if(match($checkbox$,"BB"),"B",null())</eval>
          <eval token="C">if(match($checkbox$,"CC"),"C",null())</eval>
        </condition>
      </change>
      <default>AA,BB,CC</default>
      <initialValue>AA,BB,CC</initialValue>
      <delimiter>,</delimiter>
    </input>

Once All has been checked, you can't set anything else until All is unchecked. By setting the default to all options, when All is unchecked, all the options are checked. Obviously, you can use a different default if you prefer.

0 Karma

ViniciusMariano
Explorer

I tried this option, but when I try to put "*" as a value it doesn't work, do you know why?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Probably because you didn't say you wanted "*" and you are probably missing some backslashes - try this

    <input type="checkbox" token="checkbox" id="checkABC">
      <label></label>
      <choice value="*">All</choice>
      <choice value="AA">AA</choice>
      <choice value="BB">BB</choice>
      <choice value="CC">CC</choice>
      <change>
        <condition match="match($checkbox$,&quot;\\*&quot;)">
          <unset token="A"></unset>
          <unset token="B"></unset>
          <unset token="C"></unset>
          <set token="form.checkbox">*</set>
        </condition>
        <condition>
          <eval token="A">if(match($checkbox$,"AA"),"A",null())</eval>
          <eval token="B">if(match($checkbox$,"BB"),"B",null())</eval>
          <eval token="C">if(match($checkbox$,"CC"),"C",null())</eval>
        </condition>
      </change>
      <default>AA,BB,CC</default>
      <initialValue>AA,BB,CC</initialValue>
      <delimiter>,</delimiter>
    </input>

 

gcusello
SplunkTrust
SplunkTrust

Hi @ViniciusMariano,

I don't think that's possible without JS, also because it isn't useful to have the All choice whwn you have the choice of all checkboxes.

Ciao.

Giuseppe

0 Karma

ViniciusMariano
Explorer

The "All" option would search beyond the available options, I have my groups(options) but I think would be helpful if the dashboard could search more options.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...