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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...