Hi All,
I want to create a dynamic date picker. I have been searching for this option for long time still I have not got any clue. Any help will be highly appropriated. This date will be depend on a drop down value selection. When user will select a session from the drop down value it will retrieve the session start date and session end date. This date will be used in date picker as the default date.
I have used the following code
window.onload = init;
function init() {
// When a select is changed, look for the unitlist based on the session selected
// and display on the dropdown unit list in select element
//document.write(100);
$('#id_term').change(function() {
$('#id_from').load('dropdowndatepicker.php?term=' + $('#id_term').val());
});
}
dropdowndatepicker.php have the following code
$year=2018; $month=4;$day=1;// as an example of the date that I will need
$defaulttime = make_timestamp($year, $month, $day);
echo $defaulttime;
When I echo this time, it just give the time stamp in the from id where I need to display the datepicker actually.
In the main page form element has been added as below where I need to display the date when user will select value from drop down.
$mform->addElement('select', 'term','Select Term',$termlist);
$mform->setType('term',PARAM_ALPHANUMEXT);
$mform->addElement('date_selector', 'from', get_string('from'),$yearrange);
$mform->setType('from',PARAM_INT);
Thank you in advance for your time and help.