<?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: How to clear text input after submitting? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-clear-text-input-after-submitting/m-p/144481#M29512</link>
    <description>&lt;P&gt;I would recommend reviewing the &lt;A href="http://docs.splunk.com/Documentation/WebFramework"&gt;component reference for Splunk Web&lt;/A&gt;.  Using Javascript you can select splunk object by id and most Splunk objects how multiple event listeners.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;//using TextInputView and MultiDropdownView

var hostInput = splunkjs.mvc.Components.getInstance("host-input");
var dropdownManager = splunkjs.mvc.Components.getInstance("multidropsearch1");

dropdownManager.on('change', function() {
  hostInput.settings.set("value", '')
})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is only a snippet. If you want to add an event listener I would start by extending  backbone object to added an on click event.  Just the on change should meet your need.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jul 2015 22:05:49 GMT</pubDate>
    <dc:creator>bmacias84</dc:creator>
    <dc:date>2015-07-27T22:05:49Z</dc:date>
    <item>
      <title>How to clear text input after submitting?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-clear-text-input-after-submitting/m-p/144480#M29511</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;I have created a drop-down linked with text input. I am able to search by field1, field2, field3. However, I have an issue to clear text input after submitting:&lt;/P&gt;

&lt;P&gt;For example:&lt;BR /&gt;
1)  I enter a text in “search by field1” and submit. &lt;BR /&gt;
2)  It displays the line&lt;BR /&gt;
3)  I go on “Search by field2”&lt;BR /&gt;
4)  I return on “Search by field1” and the text  that I have written at 1) is still in the text input&lt;/P&gt;

&lt;P&gt;I want that when I return in "Search by field1", the text was cleared and displays the default value *.&lt;BR /&gt;
I tried to create a clear button but didn’t work:&lt;BR /&gt;
I add this to my code :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
      &amp;lt;input type="button" value="Clear" id="clear&amp;gt;&amp;lt;/input&amp;gt;
      &amp;lt;/html&amp;gt;

and the javascript function clear.js :
var input = document.querySelector('#clear');
var textarea = document.querySelector('#output');

input.addEventListener('click', function () {
    textarea.value = '';
}, false);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there another way to clear text input ? Could you please  help me with that ?&lt;BR /&gt;
Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 16:16:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-clear-text-input-after-submitting/m-p/144480#M29511</guid>
      <dc:creator>clairebesson</dc:creator>
      <dc:date>2015-07-27T16:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear text input after submitting?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-clear-text-input-after-submitting/m-p/144481#M29512</link>
      <description>&lt;P&gt;I would recommend reviewing the &lt;A href="http://docs.splunk.com/Documentation/WebFramework"&gt;component reference for Splunk Web&lt;/A&gt;.  Using Javascript you can select splunk object by id and most Splunk objects how multiple event listeners.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;//using TextInputView and MultiDropdownView

var hostInput = splunkjs.mvc.Components.getInstance("host-input");
var dropdownManager = splunkjs.mvc.Components.getInstance("multidropsearch1");

dropdownManager.on('change', function() {
  hostInput.settings.set("value", '')
})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is only a snippet. If you want to add an event listener I would start by extending  backbone object to added an on click event.  Just the on change should meet your need.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 22:05:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-clear-text-input-after-submitting/m-p/144481#M29512</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2015-07-27T22:05:49Z</dc:date>
    </item>
  </channel>
</rss>

