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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...