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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...