<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Clear textbox value after submit in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111933#M29366</link>
    <description>&lt;P&gt;Right but won't that only listen for an actual click?  Or will it listen for any type of press of the button (like if a user hits enter instead?)  Is the difference here that you are explicitly defining the ID of the button rather than the class?&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2018 17:36:50 GMT</pubDate>
    <dc:creator>ktwingstrom</dc:creator>
    <dc:date>2018-10-17T17:36:50Z</dc:date>
    <item>
      <title>Clear textbox value after submit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111928#M29361</link>
      <description>&lt;P&gt;I have a dashboard where I want to use a textbox input to add data to a lookup file. &lt;/P&gt;

&lt;P&gt;I have managed to get this to work using an outputlookup but want to clear the text box input after I have hit the submit button to prevent the same data being added again by the user.&lt;/P&gt;

&lt;P&gt;Is there a way I can associate actions to the Submit button on a dashboard, ie clear a textbox or refresh a panel report on the dashboard?&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2015 13:52:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111928#M29361</guid>
      <dc:creator>garryclarke</dc:creator>
      <dc:date>2015-05-15T13:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Clear textbox value after submit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111929#M29362</link>
      <description>&lt;P&gt;any solution?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 15:06:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111929#M29362</guid>
      <dc:creator>jossplacencia</dc:creator>
      <dc:date>2016-07-06T15:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Clear textbox value after submit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111930#M29363</link>
      <description>&lt;P&gt;This will require JavaScript, and below is some code I just tested out:&lt;/P&gt;

&lt;P&gt;In your dashboard XML, add a script attribute to your form or dashboard tag:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="yourjavascript.js"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and add an id attribute to your text field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="yourtoken" id="yourfieldid"&amp;gt;&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Create yourjavascript.js in the following directory (create the subfolders if they don't already exist):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$SPLUNK_HOME\etc\apps\&amp;lt;yourapp&amp;gt;\appserver\static
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and add the following code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    "splunkjs/mvc",
    "splunkjs/mvc/simplexml/ready!"
], function(mvc) {

    $('button').on("click", function(e) {
        // find text field with id starting with yourfieldid
        $('[id^=yourfieldid]:text').val('')  
    });        

});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Restart Splunk for the new JavaScript file to be recognized.  My example assumes that there is only one button on your dashboard.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 13:38:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111930#M29363</guid>
      <dc:creator>kbarker302</dc:creator>
      <dc:date>2016-07-11T13:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Clear textbox value after submit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111931#M29364</link>
      <description>&lt;P&gt;@kbarker302 This is great, works perfectly.  However I wondered if there is a javascript function that would listen for the "submit" action of the form rather than a button click.  I have a dashboard with 3 text boxes and users can search by IP, Username, or DNS name.  Nobody actually clicks the search button they type the term and click enter and it searches.  Is there a way to instead of clearing the boxes on the click event clear them when the button is "clicked" via the enter key?   Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 23:02:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111931#M29364</guid>
      <dc:creator>ktwingstrom</dc:creator>
      <dc:date>2018-01-02T23:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Clear textbox value after submit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111932#M29365</link>
      <description>&lt;P&gt;If your submit button id is "btn-submit", you can use the following code:&lt;/P&gt;

&lt;P&gt;$('#btn-submit').on("click", function(e) {&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 17:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111932#M29365</guid>
      <dc:creator>marianomromano</dc:creator>
      <dc:date>2018-10-17T17:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Clear textbox value after submit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111933#M29366</link>
      <description>&lt;P&gt;Right but won't that only listen for an actual click?  Or will it listen for any type of press of the button (like if a user hits enter instead?)  Is the difference here that you are explicitly defining the ID of the button rather than the class?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 17:36:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111933#M29366</guid>
      <dc:creator>ktwingstrom</dc:creator>
      <dc:date>2018-10-17T17:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Clear textbox value after submit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111934#M29367</link>
      <description>&lt;P&gt;It will listen to a button with an id of "btn-submit".   So it is listening to the ID of the button and not all button clicks: &lt;/P&gt;

&lt;P&gt;This is the button code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        &amp;lt;div class="form-submit" id="btn-submit"&amp;gt;
          &amp;lt;button class="btn btn-primary submit"&amp;gt;Submit&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the JavaScript code would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$('#btn-submit').on("click", function(e) {
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 17:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Clear-textbox-value-after-submit/m-p/111934#M29367</guid>
      <dc:creator>marianomromano</dc:creator>
      <dc:date>2018-10-17T17:51:41Z</dc:date>
    </item>
  </channel>
</rss>

