Splunk Enterprise

How to show customize message when i uncheck both my check boxes?

Ashwini008
Builder

Hi,

I have two Check Box.When i check those checkboxes respective panels will display.

Ex: 

  • A
  • B

When i check A check box panel 1 is displayed. When i check B check box panel 2 is displayed. when i check both A & B both panel 1 and panel 2 are displayed.

Now when i uncheck both A & B i should display a message as "Check any one check box to show result"

How can i do this? Please do suggest.

Thank you!

Cheers!

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

How about in your change handler, set a token with the message if the checkbox token is null, then in each change handler set the message to an empty string

    <input type="checkbox" token="unused">
      <label>Checkbox $instruction$</label>
      <choice value="show_a">Show a</choice>
      <choice value="show_b">Show b</choice>
      <change>
        <condition match=" isnull($unused$)">
          <set token="instruction">choose an option</set>
        </condition>
        <condition value="show_a">
          <set token="show_a">1</set>
          <set token="instruction"></set>
        </condition>
        <condition value="show_b">
          <set token="show_b">1</set>
          <set token="instruction"></set>
        </condition>
      </change>
    </input>

View solution in original post

Ashwini008
Builder

@ITWhisperer It Worked. Thank you!

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

How about in your change handler, set a token with the message if the checkbox token is null, then in each change handler set the message to an empty string

    <input type="checkbox" token="unused">
      <label>Checkbox $instruction$</label>
      <choice value="show_a">Show a</choice>
      <choice value="show_b">Show b</choice>
      <change>
        <condition match=" isnull($unused$)">
          <set token="instruction">choose an option</set>
        </condition>
        <condition value="show_a">
          <set token="show_a">1</set>
          <set token="instruction"></set>
        </condition>
        <condition value="show_b">
          <set token="show_b">1</set>
          <set token="instruction"></set>
        </condition>
      </change>
    </input>

Ashwini008
Builder

@ITWhisperer  Thanks for the response. I tried above code but when i load the page initially both my check box A and B are checked(which is supposed to be) still i get the label as "choose any option" and panel 1 and 2 are not displayed until i check and uncheck either A or B check box

 

<input type="checkbox" id="checked_box" token="checkbox">
<label>$noneselected$</label>
<choice value="A">A</choice>
<choice value="B">B</choice>
<change>
<condition match="isnull($checkbox$)">
<set token="noneselected">Select atleast one Checkbox</set>
<unset token="B"></unset>
<unset token="A"></unset>
<unset token="AB"></unset>
</condition>
<condition label="A">
<set token="A">A</set>
<set token="noneselected"></set>
<unset token="B"></unset>
<unset token="AB"></unset>
</condition>
<condition label="B">
<set token="B"></set>
<set token="noneselected"></set>
<unset token="A"></unset>
<unset token="AB"></unset>
</condition>
<condition value="*">
<unset token="B"></unset>
<unset token="A"></unset>
<set token="AB"></set>
<set token="noneselected"></set>
</condition>
</change>
<default>B,A</default>
<initialValue>B,A</initialValue>
<delimiter> </delimiter>
</input>

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You should add an init block before your first row

  <init>
    <set token="noneselected"></set>
    <set token="A">A</set>
    <set token="B"></set>
  </init>
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...