<?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: Restrict users from using asterisks(*) in form inputs in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466444#M45628</link>
    <description>&lt;P&gt;Hi Niket,&lt;/P&gt;

&lt;P&gt;Thanks for your answer, I tested it and working well , but i want to include something like whenever the input value is NULL/undefined it should get changed to asterisk * internally  (not using default value setting) and search should run on a submit button click.&lt;BR /&gt;
Whenever both inputs were not mentioned OR both were marked as asterisk(&lt;EM&gt;)  , then please specify at-least one input pop should come up OR Both values are not allowed to use asterisk(&lt;/EM&gt;) at the same time &lt;BR /&gt;
and lastly if the results of the panel are zero, we need to hide that panel assuming we have more than one panel and these tokens are used across different panels.&lt;/P&gt;

&lt;P&gt;If you need any additional info please let me know&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2019 08:33:39 GMT</pubDate>
    <dc:creator>kranthimutyala</dc:creator>
    <dc:date>2019-10-28T08:33:39Z</dc:date>
    <item>
      <title>Restrict users from using asterisks(*) in form inputs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466441#M45625</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I have 2 text inputs and want to restrict an user  from entering (asterix &lt;CODE&gt;*&lt;/CODE&gt;) in  both the input fields at the same time.If they enter Asterix in any one of the field ,it is accepted but both inputs as   ( &lt;CODE&gt;*&lt;/CODE&gt; ) at the same time is not accepted. If both were entered as aestrisk ( &lt;CODE&gt;*&lt;/CODE&gt; ) we need to show a pop-up like &lt;CODE&gt;Please enter at least one input&lt;/CODE&gt;,&lt;/P&gt;

&lt;P&gt;Please help.&lt;BR /&gt;
Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Oct 2019 07:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466441#M45625</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-27T07:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict users from using asterisks(*) in form inputs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466442#M45626</link>
      <description>&lt;P&gt;You can reset for inputs in the &lt;CODE&gt;change&lt;/CODE&gt; area of the &lt;CODE&gt;fields&lt;/CODE&gt; section  by using this syntax:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;unset token="YourFieldNameHere"&amp;gt;&amp;lt;/unset&amp;gt;
&amp;lt;unset token="form.YourFieldNameHere"&amp;gt;&amp;lt;/unset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Oct 2019 22:28:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466442#M45626</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-27T22:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict users from using asterisks(*) in form inputs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466443#M45627</link>
      <description>&lt;P&gt;@kranthimutyala please try the following run anywhere example based on Splunk's _internal index which runs the SPL only if both values in the text boxes are not asterisk. If they are you get a panel with error message and you would need to reset the values in both text boxes afterwards to make they SPL run again.&lt;/P&gt;

&lt;P&gt;Please try out and confirm! Let me know if you need any help understanding components of the the Simple XML run any where dashboard code.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Both Text input should not allow asterisk&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="text" token="txtLogLevel"&amp;gt;
      &amp;lt;label&amp;gt;Provide Log Level&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition match="$value$==&amp;amp;quot;*&amp;amp;quot; AND $txtSourceType$==&amp;amp;quot;*&amp;amp;quot;"&amp;gt;
          &amp;lt;unset token="tokLogLevel"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition&amp;gt;
          &amp;lt;set token="tokLogLevel"&amp;gt;$value$&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
      &amp;lt;default&amp;gt;INFO&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="txtSourceType"&amp;gt;
      &amp;lt;label&amp;gt;Provide Log Level&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition match="$value$==&amp;amp;quot;*&amp;amp;quot; AND $txtLogLevel$==&amp;amp;quot;*&amp;amp;quot;"&amp;gt;
          &amp;lt;unset token="tokSourceType"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition&amp;gt;
          &amp;lt;set token="tokSourceType"&amp;gt;$value$&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
      &amp;lt;default&amp;gt;splunkd&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table depends="$tokLogLevel$,$tokSourceType$"&amp;gt;
        &amp;lt;title&amp;gt;Table with Results in case both Text Boxes DO NOT have asterisk&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype="$tokSourceType$" log_level="$tokLogLevel$"
 |stats count&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
      &amp;lt;html rejects="$logLevelTok$,$tokSourceType$"&amp;gt;
         &amp;lt;div&amp;gt;
           &amp;lt;p style="color:red;font-weight:bold;font-size:150%;text-align:left;"&amp;gt;
           Asterix * not allowed in both Text Boxes.
           &amp;lt;/p&amp;gt;
         &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>Mon, 28 Oct 2019 05:45:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466443#M45627</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-10-28T05:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict users from using asterisks(*) in form inputs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466444#M45628</link>
      <description>&lt;P&gt;Hi Niket,&lt;/P&gt;

&lt;P&gt;Thanks for your answer, I tested it and working well , but i want to include something like whenever the input value is NULL/undefined it should get changed to asterisk * internally  (not using default value setting) and search should run on a submit button click.&lt;BR /&gt;
Whenever both inputs were not mentioned OR both were marked as asterisk(&lt;EM&gt;)  , then please specify at-least one input pop should come up OR Both values are not allowed to use asterisk(&lt;/EM&gt;) at the same time &lt;BR /&gt;
and lastly if the results of the panel are zero, we need to hide that panel assuming we have more than one panel and these tokens are used across different panels.&lt;/P&gt;

&lt;P&gt;If you need any additional info please let me know&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 08:33:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466444#M45628</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-28T08:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict users from using asterisks(*) in form inputs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466445#M45629</link>
      <description>&lt;P&gt;Hi @kranthimutyala ,&lt;/P&gt;

&lt;P&gt;Please try the following code,&lt;BR /&gt;
- it will give a javascript alert-popup in case of both inputs are "*" or empty.&lt;BR /&gt;
- the 3 panels will only be shown once, input values are given as per the requirement.&lt;BR /&gt;
- if any panel result is zero, the panel will be hidden.&lt;/P&gt;

&lt;P&gt;Please Accept &amp;amp; Up-vote the answer if it helps.&lt;/P&gt;

&lt;P&gt;happy splunking......!!!!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="default_token.js"&amp;gt;
  &amp;lt;label&amp;gt;Default Token&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="text" token="token1"&amp;gt;
      &amp;lt;label&amp;gt;Field&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="token2"&amp;gt;
      &amp;lt;label&amp;gt;Field2&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row depends="$panel1$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Test1&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=$token1$ source=$token2$ | eval js_token=$js_token$ | head 1 | table _time, _raw&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&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="panel1"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;condition match="'job.resultCount' &amp;gt; 0"&amp;gt;
              &amp;lt;set token="panel1"&amp;gt;true&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row depends="$panel2$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Test2&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=$token1$ source=$token2$ | eval js_token=$js_token$ | head 1 | table _time, _raw&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&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="panel2"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;condition match="'job.resultCount' &amp;gt; 0"&amp;gt;
              &amp;lt;set token="panel2"&amp;gt;true&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row depends="$panel3$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Test3&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=$token1$ source=$token2$ | eval js_token=$js_token$ | head 1 | table _time, _raw&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&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="panel3"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;condition match="'job.resultCount' &amp;gt; 0"&amp;gt;
              &amp;lt;set token="panel3"&amp;gt;true&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Javascript - &lt;STRONG&gt;default_token.js&lt;/STRONG&gt;&lt;BR /&gt;
    require([&lt;BR /&gt;
        'underscore',&lt;BR /&gt;
        'jquery',&lt;BR /&gt;
        'splunkjs/mvc',&lt;BR /&gt;
        'splunkjs/mvc/tableview',&lt;BR /&gt;
        'splunkjs/mvc/searchmanager',&lt;BR /&gt;
        'splunkjs/mvc/simplexml/ready!'&lt;BR /&gt;
    ], function(_, $, mvc, TableView, SearchManager) {&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    var tokens = mvc.Components.get("default");

    $(document).on("click", "#submit", function(e){
        var tok1 = tokens.get("token1");

        var tok2 = tokens.get("token2");

        if ((tok1 == undefined || tok1 == "" || tok1 == "*") &amp;amp;&amp;amp; (tok2 == "*" || tok2 == undefined || tok2 == "")){
            tokens.set("js_token", undefined);
            alert("Please enter atleast one input.")
        } else {
            if (tok1 == undefined || tok1 == ""){
                tokens.set("token1", "*");
            }

            if (tok2 == undefined || tok2 == ""){
                tokens.set("token2", "*");
            }

            tokens.set("js_token", "1");
        }
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Oct 2019 10:44:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466445#M45629</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-10-28T10:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict users from using asterisks(*) in form inputs</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466446#M45630</link>
      <description>&lt;P&gt;you can change the query, just add eval &lt;CODE&gt;js_token = $js_token$&lt;/CODE&gt; in your query.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 10:48:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Restrict-users-from-using-asterisks-in-form-inputs/m-p/466446#M45630</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-10-28T10:48:17Z</dc:date>
    </item>
  </channel>
</rss>

