<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I disable specific choices in a checkbox input based on a condition(s)? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412840#M27120</link>
    <description>&lt;P&gt;hi @niketnilay, i also have a similar issue. not exactly the same. I have checkbox (CH1) that when uncheck will hide all the other checkboxec. but when CH1 is checked, all the other checkboxes should show. can you please advise? Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 21 Oct 2019 02:55:41 GMT</pubDate>
    <dc:creator>mrccasi</dc:creator>
    <dc:date>2019-10-21T02:55:41Z</dc:date>
    <item>
      <title>How can I disable specific choices in a checkbox input based on a condition(s)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412835#M27115</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have a checkbox with a number of choices as follows:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;c1&lt;/LI&gt;
&lt;LI&gt;c2&lt;/LI&gt;
&lt;LI&gt;c3&lt;/LI&gt;
&lt;LI&gt;c4&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;If choice c1 is checked I want all the other choices to be unchecked and disabled (greyed out or removed, either way works).&lt;BR /&gt;
Is this possible to do with simple XML or any other means without splitting the choices into multiple inputs?&lt;/P&gt;

&lt;P&gt;Thank you for your time.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 08:59:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412835#M27115</guid>
      <dc:creator>sunnyB</dc:creator>
      <dc:date>2018-08-20T08:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I disable specific choices in a checkbox input based on a condition(s)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412836#M27116</link>
      <description>&lt;P&gt;sounds like a drop down would work better in this scenario than trying to write in functionality.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 14:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412836#M27116</guid>
      <dc:creator>CarsonZa</dc:creator>
      <dc:date>2018-08-20T14:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I disable specific choices in a checkbox input based on a condition(s)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412837#M27117</link>
      <description>&lt;P&gt;I am just curious whether I am able to select choices c2 through to c4 but have checkbox c1 override all choices.&lt;BR /&gt;
A separate drop down for the first choice would be far easier to implement, my intent however is to have less input elements displayed to conserve space.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 01:18:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412837#M27117</guid>
      <dc:creator>sunnyB</dc:creator>
      <dc:date>2018-08-22T01:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I disable specific choices in a checkbox input based on a condition(s)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412838#M27118</link>
      <description>&lt;P&gt;@sunnyB, ideally you should use Simple XML JavaScript Extension with Splunk JS Stack to access/modify Token Models. If required I can provide an example for that.&lt;/P&gt;

&lt;P&gt;In your &lt;A href="https://answers.splunk.com/answers/681330/can-i-hideunhide-specific-text-boxes-using-a-singl.html"&gt;last question&lt;/A&gt; we had used an &lt;CODE&gt;independent search&lt;/CODE&gt; approach to overcome the need of an JavaScript and &lt;CODE&gt;circumvented&lt;/CODE&gt; the limitation of checkbox as per our use case. So, extending the same answer, I am going to provide you an option within Simple XML without any JavaScript dependency (which mostly makes both Splunk Developer and Splunk Admin Happy ;)).&lt;/P&gt;

&lt;P&gt;The approach I have used is that the Static Label and Value options in the checkbox have been moved to Dynamic Search option. Using token &lt;CODE&gt;tokQueryCheckBoxDynamicOptions&lt;/CODE&gt; which is initialized (using &lt;CODE&gt;&amp;lt;init&amp;gt;&lt;/CODE&gt; section) on form load as &lt;CODE&gt;&amp;lt;set token="tokQueryCheckBoxDynamicOptions"&amp;gt;C1=c1,C2=c2,C3=c3&amp;lt;/set&amp;gt;&lt;/CODE&gt;. Default value is also set when all Check Boxes are unchecked or independent search does not return any results. When you select C1, the token for filter is changed to &lt;CODE&gt;C1=c&lt;/CODE&gt;, which results in other options and Text Boxes getting hidden.&lt;/P&gt;

&lt;P&gt;PS: Since I have not messed with input form variables for check box choices. If you have C2 and/or C3 selected before you click on C1, you will have C1 related Text Box T1 displayed and other options will be hidden. However, when you un-check C1, it will display check box/s and text box/es as per your last selection before you clicked C1.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5586iF1021CF62B5DC209/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Please try out and confirm! Let me know if you need Simple XML JS based approach as well... Since that will be more straightforward from coding perspective.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Checkbox with Multiple dynamic choices&amp;lt;/label&amp;gt;
  &amp;lt;init&amp;gt;
    &amp;lt;set token="tokQueryCheckBoxDynamicOptions"&amp;gt;C1=c1,C2=c2,C3=c3&amp;lt;/set&amp;gt;
    &amp;lt;unset token="debugIndependentSearch"&amp;gt;&amp;lt;/unset&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;!-- Independent Search to Set Multiple Tokens from Single Check Box--&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;| makeresults 
 | fields - _time 
 | eval checkBox=if(isnull($tokShowTextBox|s$),"",$tokShowTextBox|s$) 
 | eval checkBox=replace(checkBox,"\s",",")
 | eval tokShowT1=case(match(checkBox,"c1"),"true") 
 | eval tokShowT2=case(match(checkBox,"c2") AND NOT match(checkBox,"c1"),"true")
 | eval tokShowT3=case(match(checkBox,"c3") AND NOT match(checkBox,"c1"),"true")
 | eval tokQueryCheckBoxDynamicOptions=case(match(checkBox,"c1"),"C1=c1",true(),"C1=c1,C2=c2,C3=c3")&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;-1s&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;condition match="$job.resultCount$==0"&amp;gt;
        &amp;lt;unset token="tokShowT1"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;unset token="tokShowT2"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;unset token="tokShowT3"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;set token="tokQueryCheckBoxDynamicOptions"&amp;gt;C1=c1,C2=c2,C3=c3&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
      &amp;lt;condition&amp;gt;
        &amp;lt;eval token="tokShowT1"&amp;gt;case(isnotnull($result.tokShowT1$),"true")&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="tokShowT2"&amp;gt;case(isnotnull($result.tokShowT2$),"true")&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="tokShowT3"&amp;gt;case(isnotnull($result.tokShowT3$),"true")&amp;lt;/eval&amp;gt;
        &amp;lt;set token="tokQueryCheckBoxDynamicOptions"&amp;gt;$result.tokQueryCheckBoxDynamicOptions$&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;&amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;input type="checkbox" token="tokShowTextBox"&amp;gt;
        &amp;lt;label&amp;gt;Select Textbox to Show&amp;lt;/label&amp;gt;
        &amp;lt;delimiter&amp;gt; &amp;lt;/delimiter&amp;gt;
        &amp;lt;change&amp;gt;
          &amp;lt;!-- Handle Unset all tokens when no Check Box is checked. As independent search will not run --&amp;gt;
          &amp;lt;condition match="isnull($tokShowTextBox$)"&amp;gt;
            &amp;lt;unset token="tokShowT1"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;unset token="tokShowT2"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;unset token="tokShowT3"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;set token="tokQueryCheckBoxDynamicOptions"&amp;gt;C1=c1,C2=c2,C3=c3&amp;lt;/set&amp;gt;
          &amp;lt;/condition&amp;gt;
        &amp;lt;/change&amp;gt;
        &amp;lt;fieldForLabel&amp;gt;Label&amp;lt;/fieldForLabel&amp;gt;
        &amp;lt;fieldForValue&amp;gt;Value&amp;lt;/fieldForValue&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| fields - _time
| eval _raw="$tokQueryCheckBoxDynamicOptions$"
| KV
| transpose column_name="Label"
| search Label!="_*"
| rename "row 1" as Value&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="t1" depends="$tokShowT1$"&amp;gt;
        &amp;lt;label&amp;gt;T1&amp;lt;/label&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="t2" depends="$tokShowT2$"&amp;gt;
        &amp;lt;label&amp;gt;T2&amp;lt;/label&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="t3" depends="$tokShowT3$"&amp;gt;
        &amp;lt;label&amp;gt;T3&amp;lt;/label&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;html&amp;gt;
         &amp;lt;div&amp;gt;tokShowTextBox: $tokShowTextBox$&amp;lt;/div&amp;gt;
         &amp;lt;div&amp;gt;tokShowT1: $tokShowT1$&amp;lt;/div&amp;gt;
         &amp;lt;div&amp;gt;tokShowT2: $tokShowT2$&amp;lt;/div&amp;gt;
         &amp;lt;div&amp;gt;tokShowT3: $tokShowT3$&amp;lt;/div&amp;gt;
         &amp;lt;div&amp;gt;tokQueryCheckBoxDynamicOptions: $tokQueryCheckBoxDynamicOptions$&amp;lt;/div&amp;gt;
       &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 02:45:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412838#M27118</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-22T02:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I disable specific choices in a checkbox input based on a condition(s)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412839#M27119</link>
      <description>&lt;P&gt;@sunnyB if your issue is resolved, please accept the answer to mark this question as answered.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 02:11:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412839#M27119</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-09-05T02:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I disable specific choices in a checkbox input based on a condition(s)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412840#M27120</link>
      <description>&lt;P&gt;hi @niketnilay, i also have a similar issue. not exactly the same. I have checkbox (CH1) that when uncheck will hide all the other checkboxec. but when CH1 is checked, all the other checkboxes should show. can you please advise? Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 02:55:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412840#M27120</guid>
      <dc:creator>mrccasi</dc:creator>
      <dc:date>2019-10-21T02:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I disable specific choices in a checkbox input based on a condition(s)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412841#M27121</link>
      <description>&lt;P&gt;If you have single checkbox which shows or hides other textboxes, this should be straightforward case of using change event handler of checkbox to unset/setultiple tokens as the change event handler works for chwckbox with single value.&lt;/P&gt;

&lt;P&gt;If the same is not working you may have to post additional details and post the same as a new question so that it receives required attention from the community experts.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 13:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-disable-specific-choices-in-a-checkbox-input-based-on/m-p/412841#M27121</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-10-21T13:11:30Z</dc:date>
    </item>
  </channel>
</rss>

