<?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 KV Store: How to add 2 jquery date pickers to my HTML dashboard? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279037#M17695</link>
    <description>&lt;P&gt;Hello! &lt;/P&gt;

&lt;P&gt;I want to add in 2 jquery datepickers to my html dashboard. &lt;/P&gt;

&lt;P&gt;I can see the jquery date picker calendar, but whenever I click a date, the input field does not populate. I think I'm missing very simple and I'd love feedback..&lt;/P&gt;

&lt;P&gt;Please keep in mind I'm pretty new to HTML/Javascript. I used the KV Store tutorial, and inserted some code...&lt;/P&gt;

&lt;P&gt;HTML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div type="text" name="date" id="input3" class="datepicker"&amp;gt;
 &amp;lt;label&amp;gt;DCT_DueDate&amp;lt;/label&amp;gt;
 &amp;lt;/div&amp;gt; &amp;amp;lt;br/&amp;amp;gt;

&amp;lt;div type="text" name="date" id="input4" class="datepicker"&amp;gt;
 &amp;lt;label&amp;gt;DIA_DueDate&amp;lt;/label&amp;gt;
 &amp;lt;/div&amp;gt; &amp;amp;lt;br/&amp;amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;JAVASCRIPT:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;script&amp;gt;
    $(function() {
        $("#input3").datepicker();

    });

    var input3 = new TextInput({
        "id": "input3",
        "value": "$form.DCT_DueDate$",
        "el": $('#input3')
    }, {tokens: true}).render();

    input3.on("change", function(newValue) {
        FormUtils.handleValueChange(input3);
    });

    var input4 = new TextInput({
        "id": "input4",
        "value": "$form.DIA_DueDate$",
        "el": $('#input4')
    }, {tokens: true}).render();

    input4.on("change", function(newValue) {
        FormUtils.handleValueChange(input4);
    });
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 14 Dec 2015 05:15:47 GMT</pubDate>
    <dc:creator>pmardo</dc:creator>
    <dc:date>2015-12-14T05:15:47Z</dc:date>
    <item>
      <title>KV Store: How to add 2 jquery date pickers to my HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279037#M17695</link>
      <description>&lt;P&gt;Hello! &lt;/P&gt;

&lt;P&gt;I want to add in 2 jquery datepickers to my html dashboard. &lt;/P&gt;

&lt;P&gt;I can see the jquery date picker calendar, but whenever I click a date, the input field does not populate. I think I'm missing very simple and I'd love feedback..&lt;/P&gt;

&lt;P&gt;Please keep in mind I'm pretty new to HTML/Javascript. I used the KV Store tutorial, and inserted some code...&lt;/P&gt;

&lt;P&gt;HTML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div type="text" name="date" id="input3" class="datepicker"&amp;gt;
 &amp;lt;label&amp;gt;DCT_DueDate&amp;lt;/label&amp;gt;
 &amp;lt;/div&amp;gt; &amp;amp;lt;br/&amp;amp;gt;

&amp;lt;div type="text" name="date" id="input4" class="datepicker"&amp;gt;
 &amp;lt;label&amp;gt;DIA_DueDate&amp;lt;/label&amp;gt;
 &amp;lt;/div&amp;gt; &amp;amp;lt;br/&amp;amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;JAVASCRIPT:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;script&amp;gt;
    $(function() {
        $("#input3").datepicker();

    });

    var input3 = new TextInput({
        "id": "input3",
        "value": "$form.DCT_DueDate$",
        "el": $('#input3')
    }, {tokens: true}).render();

    input3.on("change", function(newValue) {
        FormUtils.handleValueChange(input3);
    });

    var input4 = new TextInput({
        "id": "input4",
        "value": "$form.DIA_DueDate$",
        "el": $('#input4')
    }, {tokens: true}).render();

    input4.on("change", function(newValue) {
        FormUtils.handleValueChange(input4);
    });
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Dec 2015 05:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279037#M17695</guid>
      <dc:creator>pmardo</dc:creator>
      <dc:date>2015-12-14T05:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: KV Store: How to add 2 jquery date pickers to my HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279038#M17696</link>
      <description>&lt;P&gt;You can use code blocks to allow your HTML markup&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;LIKE THIS&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Dec 2015 14:53:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279038#M17696</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2015-12-14T14:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: KV Store: How to add 2 jquery date pickers to my HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279039#M17697</link>
      <description>&lt;P&gt;Here's what you pasted:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div type="text" name="date" id="input3" class="datepicker"&amp;gt;
&amp;lt;label&amp;gt;DCT_DueDate &amp;lt;/label&amp;gt;
&amp;lt;/div&amp;gt; &amp;amp;lt;br/&amp;amp;gt;

&amp;lt;div type="text" name="date" id="input4" class="datepicker"&amp;gt;
&amp;lt;label&amp;gt;DIA_DueDate&amp;lt;/label&amp;gt;
&amp;lt;/div&amp;gt; &amp;amp;lt;br/&amp;amp;gt;

JAVASCRIPT:
&amp;lt;script&amp;gt;
$(function() {
$("#input3").datepicker();}
);

     var input3 = new TextInput({
         "id": "input3",
         "value": "$form.DCT_DueDate$",
         "el": $('#input3')
     }, {tokens: true}).render();
     input3.on("change", function(newValue) {
         FormUtils.handleValueChange(input3);
     });

     var input4 = new TextInput({
         "id": "input4",
         "value": "$form.DIA_DueDate$",
         "el": $('#input4')
     }, {tokens: true}).render();
     input4.on("change", function(newValue) {
         FormUtils.handleValueChange(input4);
     });
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You start the JAVASCRIPT with "$(" but dont have ending ")"&lt;/P&gt;

&lt;P&gt;You mention "function()" but this might not be correct use of function command..  "function functionName()" is correct i think.&lt;/P&gt;

&lt;P&gt;You go on to call your function in this manner "function(newValue)" which means you're passing a copy of the variable named newValue to your function that doesnt appear to be capable of receiving a variable???  not certain on this one.  &lt;/P&gt;

&lt;P&gt;You might want to use the MVC stuff mentioned on this post instead:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/288446/how-to-implement-jquery-in-an-html-dashboard-to-ad.html"&gt;https://answers.splunk.com/answers/288446/how-to-implement-jquery-in-an-html-dashboard-to-ad.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 15:09:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279039#M17697</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2015-12-14T15:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: KV Store: How to add 2 jquery date pickers to my HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279040#M17698</link>
      <description>&lt;P&gt;haha thanks for mentioning this. i was trying to lookup html markup and originally did the html tag but not the body tag!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 16:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279040#M17698</guid>
      <dc:creator>pmardo</dc:creator>
      <dc:date>2015-12-14T16:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: KV Store: How to add 2 jquery date pickers to my HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279041#M17699</link>
      <description>&lt;P&gt;Can you be more specific on how you would implement the MVC component? I saw this question but wasn't sure how to use it. I couldn't find documentation on it.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 16:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279041#M17699</guid>
      <dc:creator>pmardo</dc:creator>
      <dc:date>2015-12-14T16:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: KV Store: How to add 2 jquery date pickers to my HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279042#M17700</link>
      <description>&lt;P&gt;// I know this isn't right, but am I going in the right direction? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    $(function dueDates() {
       mvc.Components.getInstance("input3").val('');
       mvc.Components.getinstance("input4").val('');
    });

    $(".datepicker").on('click', function(){
        dueDates())
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;// Not sure if the code below is needed..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    var input3 = new TextInput({
        "id": "input3",
        "value": "$form.DCT_DueDate$",
        "el": $('#input3')
    }, {tokens: true}).render();

    input3.on("change", function(newValue) {
        FormUtils.handleValueChange(input3);
    });

    var input4 = new TextInput({
        "id": "input4",
        "value": "$form.DIA_DueDate$",
        "el": $('#input4')
    }, {tokens: true}).render();

    input4.on("change", function(newValue) {
        FormUtils.handleValueChange(input4);
    });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Dec 2015 16:40:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279042#M17700</guid>
      <dc:creator>pmardo</dc:creator>
      <dc:date>2015-12-14T16:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: KV Store: How to add 2 jquery date pickers to my HTML dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279043#M17701</link>
      <description>&lt;P&gt;//Use this. I implemented this in my current assignment and it worked perfectly for me.&lt;/P&gt;

&lt;P&gt;var input12 = new TextInput({&lt;BR /&gt;
            "id": "input12",&lt;BR /&gt;
            "value": "$form.StartDate$",&lt;BR /&gt;
        "default": "$StartDate$",&lt;BR /&gt;
            "el": $('#input12')&lt;BR /&gt;
        }, {tokens: true}).render();&lt;BR /&gt;
        $("input[id^='input12']").datepicker();&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    input12.on("change", function(newValue) {
        FormUtils.handleValueChange(input12);
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;//when the back end Code is generated,Splunk adds up some extra digits at the end of the  input12, this piece of code&lt;BR /&gt;
 $("input[id^='input12']") ensures that it ignores what ever is at the end of input12 and calls the date picker function for that input.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 11:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/KV-Store-How-to-add-2-jquery-date-pickers-to-my-HTML-dashboard/m-p/279043#M17701</guid>
      <dc:creator>mousumide</dc:creator>
      <dc:date>2017-06-28T11:35:48Z</dc:date>
    </item>
  </channel>
</rss>

