Dashboards & Visualizations

Can you help me with a checkbox with 2 tokens that populates a search?

mwdbhyat
Builder

Hi there,

I have a checkbox that I want to have 2 tokens to populate a search.

So when it's ticked(default) it must populate my dashboard search with one value, and if the user unticks it, then I want it to insert another value for the search.

Any thoughts on how to do this?

Thanks!

0 Karma
1 Solution

vnravikumar
Champion

Hi

Try like

<form>
  <label>checkboxtoken</label>
  <fieldset submitButton="false">
    <input type="checkbox" token="field1">
      <label>field1</label>
      <choice value="sample">sample</choice>
      <change>
        <condition value="sample">
          <set token="token1">value1</set>
          <unset token="token2"></unset>
        </condition>
        <condition>
          <set token="token2">value2</set>
          <unset token="token1"></unset>
        </condition>
      </change>
      <initialValue>sample</initialValue>
      <delimiter> </delimiter>
    </input>
  </fieldset>
</form>

OR

with single token

<form>
  <label>checkboxtoken</label>
  <fieldset submitButton="false">
    <input type="checkbox" token="field1">
      <label>field1</label>
      <choice value="sample">sample</choice>
      <change>
        <condition value="sample">
          <set token="token1">value1</set>
        </condition>
        <condition>
          <set token="token1">value2</set>
        </condition>
      </change>
      <initialValue>sample</initialValue>
      <delimiter> </delimiter>
    </input>
  </fieldset>
</form>

View solution in original post

vnravikumar
Champion

Hi

Try like

<form>
  <label>checkboxtoken</label>
  <fieldset submitButton="false">
    <input type="checkbox" token="field1">
      <label>field1</label>
      <choice value="sample">sample</choice>
      <change>
        <condition value="sample">
          <set token="token1">value1</set>
          <unset token="token2"></unset>
        </condition>
        <condition>
          <set token="token2">value2</set>
          <unset token="token1"></unset>
        </condition>
      </change>
      <initialValue>sample</initialValue>
      <delimiter> </delimiter>
    </input>
  </fieldset>
</form>

OR

with single token

<form>
  <label>checkboxtoken</label>
  <fieldset submitButton="false">
    <input type="checkbox" token="field1">
      <label>field1</label>
      <choice value="sample">sample</choice>
      <change>
        <condition value="sample">
          <set token="token1">value1</set>
        </condition>
        <condition>
          <set token="token1">value2</set>
        </condition>
      </change>
      <initialValue>sample</initialValue>
      <delimiter> </delimiter>
    </input>
  </fieldset>
</form>

mwdbhyat
Builder

Thanks that worked!

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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