<?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 do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210170#M13147</link>
    <description>&lt;P&gt;any way to do this in simple XML?&lt;/P&gt;</description>
    <pubDate>Tue, 22 May 2018 16:18:39 GMT</pubDate>
    <dc:creator>wkupersa</dc:creator>
    <dc:date>2018-05-22T16:18:39Z</dc:date>
    <item>
      <title>How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210166#M13143</link>
      <description>&lt;P&gt;I am creating a form (Simple XML converted to HTML) in Splunk 6.3.1.  The form contains several form inputs, including drop-down, checkbox group, text, and radio button.  Since there are several inputs, I want to give the user a way to reset all of the inputs to their default values.  I have added a "Reset" button to my form and given it an "on" submit function in javascript.  (see code below).  In the function, I call &lt;CODE&gt;defaultTokenModel.clear()&lt;/CODE&gt;.  This does clear all the tokens, but leaves all the inputs in a state where there is no default selection.  How can I make all the inputs go back to their default values?  &lt;/P&gt;

&lt;P&gt;The code below shows a drop-down with choices of =, !=, &amp;lt;, &amp;gt;.  The default value when the form is loaded is =.  If I press my reset button (which calls &lt;CODE&gt;defaultTokenModel.clear()&lt;/CODE&gt;), the drop-down goes to a state where nothing is selected.  I want to make it show the default value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var input24 = new DropdownInput({
    "id": "input24",
    "choices": [
         {"value": "=", "label": "="},
         {"value": "!=", "label": "!="},
         {"value": "&amp;gt;", "label": "&amp;gt;"},
         {"value": "&amp;lt;", "label": "&amp;lt;"},
    "default": "=",
    "searchWhenChanged": false,
    "showClearButton":true,
    "value": "$op_tok$",
    "el": $('#input24')
}), {tokens: true}).render();

    var resetBtn = new SubmitButton({
        id: 'reset',
      text: 'Reset',
        el: $('#reset_btn')
    }, {tokens: true}).render();

    resetBtn.on("submit", function() {
        submittedTokenModel.clear();
        defaultTokenModel.clear();
    });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2016 15:22:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210166#M13143</guid>
      <dc:creator>lyndac</dc:creator>
      <dc:date>2016-04-20T15:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210167#M13144</link>
      <description>&lt;P&gt;Try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;resetBtn.on("submit", function() {
    defaultTokenModel.set(urlTokenModel.toJSON());
    console.log(urlTokenModel.toJSON());
     });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2016 16:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210167#M13144</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-20T16:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210168#M13145</link>
      <description>&lt;P&gt;That doesn't seem to have any effect.  The output was:&lt;/P&gt;

&lt;P&gt;Object { form.timer_tok.earliest: "-24h@h", form.timer_tok.latest: "now", earliest: "0", latest: ""}&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:27:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210168#M13145</guid>
      <dc:creator>lyndac</dc:creator>
      <dc:date>2020-09-29T09:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210169#M13146</link>
      <description>&lt;P&gt;how about putting a link on your dashboard pointing to same dashboard. This will force it to reload everything with default setting. Don't  forget to replace &lt;STRONG&gt;&lt;EM&gt;{dashboard_filename}&lt;/EM&gt;&lt;/STRONG&gt; with the your actual dashboard file name/URL.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
       &amp;lt;a href="{dashboard_filename}" class="reset_btn"&amp;gt;Reset Dashboard&amp;lt;/a&amp;gt;
       &amp;lt;style&amp;gt;

          .reset_btn{

              border-radius: 5px;
              font-size: 12px; 

              font-family:"Roboto","Droid","Helvetica Neue",Helvetica,Arial,sans-serif;
              text-decoration: none;
              background-color: #EEEEEE;
              color: #333333;
              padding: 6px 8px 6px 8px;
              border-top: 1px solid #CCCCCC;
              border-right: 1px solid #333333;
              border-bottom: 1px solid #333333;
              border-left: 1px solid #CCCCCC;
            }

      &amp;lt;/style&amp;gt;

     &amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Feb 2017 20:35:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210169#M13146</guid>
      <dc:creator>spammenot66</dc:creator>
      <dc:date>2017-02-13T20:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210170#M13147</link>
      <description>&lt;P&gt;any way to do this in simple XML?&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 16:18:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210170#M13147</guid>
      <dc:creator>wkupersa</dc:creator>
      <dc:date>2018-05-22T16:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210171#M13148</link>
      <description>&lt;P&gt;You can use &lt;CODE&gt;&amp;lt;unset&amp;gt;&lt;/CODE&gt; token to unset the tokens (including form tokens). Each token would need one &lt;CODE&gt;&amp;lt;unset&amp;gt;&lt;/CODE&gt; node. However, you can do so by using one of Splunk's inputs if you do not want to use JavaScript. If you need a Button to reset the tokens, you would need to code Button Click handler through JavaScript.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#unset"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#unset&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;@wkupersa, if you face any issue while implementing unset token block using Simple XML, I would request you to post a new question with the required details specific to your use case and community members would be able to assist!&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 16:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210171#M13148</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-22T16:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210172#M13149</link>
      <description>&lt;P&gt;Thanks! That is what I arrived at. I found this example to include the button handler in the simple XML dashboard.  &lt;A href="https://answers.splunk.com/answers/581652/how-can-i-create-a-button-switcher.html"&gt;https://answers.splunk.com/answers/581652/how-can-i-create-a-button-switcher.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 17:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210172#M13149</guid>
      <dc:creator>wkupersa</dc:creator>
      <dc:date>2018-05-22T17:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210173#M13150</link>
      <description>&lt;P&gt;@wkupersa, that is one of my older posts controlling tokens through Button click via JavaScript. If you found it useful do up vote &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 19:17:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210173#M13150</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-22T19:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210174#M13151</link>
      <description>&lt;P&gt;Why so it is! You are everywhere!  upvoted. &lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 22:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210174#M13151</guid>
      <dc:creator>wkupersa</dc:creator>
      <dc:date>2018-05-22T22:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210175#M13152</link>
      <description>&lt;P&gt;I downvoted this post because answer is not convenient&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 17:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210175#M13152</guid>
      <dc:creator>Dawson014</dc:creator>
      <dc:date>2018-09-05T17:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reset form input fields to their default value on-click of a button on a Splunk 6.3.1 HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210176#M13153</link>
      <description>&lt;P&gt;I downvoted this post because this does not work&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 17:20:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-reset-form-input-fields-to-their-default-value-on-click/m-p/210176#M13153</guid>
      <dc:creator>Dawson014</dc:creator>
      <dc:date>2018-09-05T17:20:34Z</dc:date>
    </item>
  </channel>
</rss>

