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!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...