CurrentDate default with datepicker in Spotfire

Hi All,

With reference to http://spotfired.blogspot.in/2014/05/popup-calendar-webplayer-compatible.html.

Can you please suggest how to get the current date in the input field as soon as the analysis is open in Webplayer.

Code that I am using:

HTML Code:


    <spotfirecontrol id="a8b5b0d725bd41f385c3a859b511ae0b"></spotfirecontrol>
    <spotfirecontrol id="a8b5b0d725bd41f385c3a859b511ae0b"></spotfirecontrol>
    <spotfirecontrol id="a8b5b0d725bd41f385c3a859b511ae0b"></spotfirecontrol>

JS:

//update document property after selection
function datePicker_onSelect(selectedDate){
//alert(selectedDate)
$("#dt1 input").focus()
$("#dt1 input").blur()
}

//jquery datepicker configuration
//you can comment the buttonImageOnly and buttonImage lines to show a button instead of a calendar or the image of your choice.
pickerOptions = {
   showOn: 'button',
   buttonImageOnly: true,
   buttonImage: 'http://staff.washington.edu/tabrooks/343INFO/UnobtrusiveDatePicker/cal-grey.gif',
   minDate: "-36M",
   maxDate: "+0D",
   changeMonth: true,
   changeYear: true,
   altField:"#dt1 input",
   onSelect:datePicker_onSelect
   }

//create the date picker
document.getElementById('dt1picker').innerHTML=""\$("#datePicker").datepicker(pickerOptions);
//--My code to get current date as soon as the analysis is load.
var now = new Date();

var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear() + "-" + (month) + "-" + (day);

$('#dt1').val(today);

1 Comment

I believe that I've repaired this question, soni.archit.
Don Johnson - Apr 12, 2016 - 3:07pm ::
+ Add a Comment

(5) Answers

Login