Hello, I'm trying to add a simple date picker to a dashboard. I'm still pretty new to Splunk and Javascript so I'm hoping I'm just missing something simple. I've found other posts like:
https://com...
See more...
Hello, I'm trying to add a simple date picker to a dashboard. I'm still pretty new to Splunk and Javascript so I'm hoping I'm just missing something simple. I've found other posts like:
https://community.splunk.com/t5/Dashboards-Visualizations/using-splunk-UI-to-select-a-specific-date/m-p/481151
https://community.splunk.com/t5/Dashboards-Visualizations/Calendar-date-picker/m-p/49711
https://community.splunk.com/t5/Dashboards-Visualizations/Jquery-datepicker-in-splunk/m-p/361049
However I'm still unable to get what I'd like, which is 1 calendar so the user can pick a date. Most of the solutions are to select 2 dates for a range. For me, the range will always be 1 day as the dashboard only shows daily reports.
I did find https://medium.com/@nikolayryabykh/splunk-s01e03-the-one-with-js-and-css-b8c78851481c that has an example with a single date calendar picker but I'm having trouble making it work, maybe because it's from 2018. TL;DR, the instructions say to add:
<input type="text" token="token_date" id="date">
<label>Test textbox:</label>
</input>
Then create a Javascript file with this:
require(["jquery", "splunkjs/mvc/simplexml/ready!"], function($) {
$("[id^=date]")
.attr('type', 'date')
.attr('min', '2018-01-11')
});
And add this:
<dashboard script="input.js">
I did Step 1 and 2 (via Upload Asset). I didn't do Step 3 as another procedure I was testing didn't require me to put script="input.js" in the form tag.
Thanks in advance!