Dashboards & Visualizations

Hiding default value in text input.

AditiKulkarni
New Member

I want to develope a dashboard which has a search criteria having multiple text inputs. The default value for text input is "All" i.e. %. The code for same is as below :

<input type="text" token="var_tkn" searchWhenChanged="false">

%

But when i run this code, "%" value is shown in the text box. I don't want to show the "%" value in text box but want to show "blank" or "All" in the text box. How can i achieve this? How can i hide % in the textbox?

Tags (2)
0 Karma

niketn
Legend

@AditiKulkarni, please try the following run anywhere dashboard example.

Default value for the text box input txtName is All, however, the <change>Event Handler of text box is used to pass on the value of tokenvar_tkn as % whenever the selected value in textbox is All

<form>
  <label>Change TextBox Default Value</label>
  <fieldset submitButton="false">
    <input type="text" token="txtName" searchWhenChanged="true">
      <label>Variable Name</label>
      <default>All</default>
      <change>
        <condition value="All">
          <set token="var_tkn">%</set>
        </condition>
        <condition>
          <set token="var_tkn">$value$</set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults
| eval var_tkn="$var_tkn$" 
| table var_tkn
          </query>
        </search>
      </table>
    </panel>
  </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

493669
Super Champion

Try Below

<input>
....
<fieldForLabel>All</fieldForLabel>
<fieldForValue>%</fieldForValue>
</input>
0 Karma

richgalloway
SplunkTrust
SplunkTrust

One way is to put the desired string in your input statement and then change it at search time.

<input type="text" token="var_tkn" searchWhenChanged="false">
Variable name
All 
</input>
...
<searchString>index = foo | eval Variable name=if(Variable name="All","%",Variable name) | ... </searchString>
---
If this reply helps you, Karma would be appreciated.
0 Karma

AditiKulkarni
New Member

It is not working. Could you please suggest some other way?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...