Splunk Search

How do you reset a dashboard field after hitting the submit button?

mrtolu6
Path Finder

I have a dashboard form that uses free text inputs to write into a CSV file. How do I get the fields to reset after I hit the submit button?

Is it possible to create a dashboard using datepicker to select a date that would write into the lookup?

Tags (1)
0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

hi @mrtolu6,

Did you have a chance to check out @niketnilay 's answer? If it worked, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help ya.

Thanks for posting!

0 Karma

niketn
Legend

@mrtolu6 please try the following run anywhere example. It takes a text input and displays the same in the panel. Once the Panel Search completes the text box token is cleaned up.

The <change> event handler of the text box is used to set the token passed in the search for the panel (using text box's predefined token $value$ to access selected text box value on change). In case the Text box value is null or empty token is not set.

      <change>
        <condition match="isnotnull($value$) AND $value$!=&quot;&quot;">
          <set token="tokTextFilter">$value$</set>
        </condition>
      </change>

On completing the search, the <done> event handler is used to <unset> the Text Box value:

          <done>
            <unset token="form.tokData"></unset>
          </done>

Please check out the following complete Simple XML code and try out to confirm whether it fits your needs.

<form>
  <label>Text Box Token Reset</label>
  <fieldset submitButton="false">
    <input type="text" token="tokData">
      <label>field1</label>
      <change>
        <condition match="isnotnull($value$) AND $value$!=&quot;&quot;">
          <set token="tokTextFilter">$value$</set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row depends="$tokTextFilter$">
    <panel>
      <table>
        <search>
          <query>| makeresults 
| fields - _time
| eval data= "$tokTextFilter$"</query>
          <earliest>-1s</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
          <done>
            <unset token="form.tokData"></unset>
          </done>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

DanEhrlich
Loves-to-Learn

This works to clear the form field.  But the URL is not modified to reflect this fact.  So, if the page gets refreshed by the user or was left open when the browser was shut down and the user has the start where I left off option set the page will rerun the dash board.

How does one clear the field and reset the URL to reflect that fact?

0 Karma

xZinou
Explorer

Hello,
Can you please help reset inputs into a "default" value? I want to set my inputs to "*" after submitting.
Thank you very much.
BR.

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