Dashboards & Visualizations

Text Box not updating Dashboard

skirven
Communicator

Hi! In Splunk 7.2.0, I'm trying to get a Dashboard that has a Text Box in it, and when you type a value in, I would expect it to update the Dashboard.

I've tried multiple ways, even trying with the changed of the token, but nothing's ever refreshing the dashboard. 😞 My sample code is below. I've seen some references to having to possibly use JavaScript to do this? Are we needing to install another app to make this work? I know the tokens work, because they impact other areas of my dashboard.
Thanks!
Stephen

<input type="text" token="client_action" searchWhenChanged="true">
  <label>Client Action</label>
  <default>*</default>
  <change>
    <condition value="changed">
      <set token="clientaction">$client_action$</set>
    </condition>
  </change>
</input>
0 Karma

niketn
Legend

@skirven your code snippet is quite confusing.

As per your code, only if you type "changed" in the text box the value will be assigned to the token $client_action$. However, even with that there is actually a delay of one change because you have used $client_action$ instead of $value$ to access the changed value.

For the community to assist you better just provide what is the use case of text box i.e. once the value changes do you want to pass on the same changed value to the search or something else?

If it is just the changed value then you do not even need the change event handler of text input. You can simply use the following code:

 <input type="text" token="client_action" searchWhenChanged="true">
   <label>Client Action</label>
   <default>*</default>
 </input>

Where $client_action$ will have text box changed value that can be used in searches.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

skirven
Communicator

Hi folks. What I want to do is have a Text Box capture a value, and store it in token $client_action$. This works fine with a Default value, but when I actually edit the text in the box (changed?)

@niketnilay - O actually started with the example like the one you provided, and also validated against what @gcusello has said, and it all looks correct from my side.

What I have now (which still doesn't affect searches when the text changes, is:

  <fieldset submitButton="false" autoRun="true">
    <input type="text" token="timeout">
      <label>Timeout Value</label>
      <default>10000</default>
    </input>
    **<input type="text" token="client_action" searchWhenChanged="true">
      <label>Client Action</label>
      <default>*</default>
    </input>**
    <input type="checkbox" token="clientaction" searchWhenChanged="true">
      <label></label>
      <choice value="set">NOT IN</choice>
      <delimiter> </delimiter>
      <change>
        <condition value="set">
          <set token="clientaction">NOT Client_Action IN ( $client_action$ )</set>
        </condition>
        <condition>
          <set token="clientaction">Client_Action IN ( $client_action$ )</set>
        </condition>
      </change>
    </input>
    <input type="time" token="time_period" searchWhenChanged="true">
      <label>Time Period</label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @skirven,
I'm not sure to have completely understood your need,but I think that you should see in the Splunk Dashboard Examples App ( https://splunkbase.splunk.com/app/1603/ ) the "Text Form Input Element" Dashboard where is an example of this.
Something like this:

<form>
    <label>Text Form Input Element</label>
    <description>Set search terms by populating a form with textbox input.</description>
    <fieldset autoRun="true" submitButton="false">
        <input type="text" token="limit" searchWhenChanged="true">
            <label>Enter an integer N:</label>
            <default>5</default>
        </input>
    </fieldset>
    <row>
        <table>
            <title>Top $limit$ Sourcetypes based on N entered by user</title>
            <search>
                <query>index=_internal | top limit=$limit$ sourcetype | eval percent = round(percent,2)</query>
                <earliest>-24h</earliest>
                <latest>now</latest>
            </search>
            <option name="rowNumbers">true</option>
        </table>
    </row>
</form>

Ciao.
Giuseppe

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @skirven,
let me understand:
you have a text box and you can search in the dashboard using the values you inserted in it.
Your need is that, when you change the value in the text box, you want to re-run the search obtaining a different search results, is it correct?

For my knowledge, when you change the content of a text box and you press Enter, the search is renewed, as you can test in the Dashboard Examples App, so probably I didn't understood what you need, can you share more details?

Ciao.
Giuseppe

0 Karma

vnravikumar
Champion

Hi

Can you please explain your requirement in detail?

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 ...