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 (3)
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!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...