diff --git a/main/inc/lib/formvalidator/Element/datepicker.php b/main/inc/lib/formvalidator/Element/datepicker.php index d3d8a348de..81c3b3851a 100755 --- a/main/inc/lib/formvalidator/Element/datepicker.php +++ b/main/inc/lib/formvalidator/Element/datepicker.php @@ -1,26 +1,5 @@ _locale[$lang_code]['months_long'] = api_get_months_long(); } $this->_options['format'] = 'dFY '.$popup_link.' H '.$hour_minute_devider.' i'; - $this->_options['minYear'] = date('Y')-7; - $this->_options['maxYear'] = date('Y')+15; + $this->_options['minYear'] = date('Y')-5; + $this->_options['maxYear'] = date('Y')+10; $this->_options['language'] = $lang_code; //$this->_options['addEmptyOption'] = true; //$this->_options['emptyOptionValue'] = 0; diff --git a/main/inc/lib/formvalidator/Element/datepickerdate.php b/main/inc/lib/formvalidator/Element/datepickerdate.php index c556fc04fc..6ab1862812 100755 --- a/main/inc/lib/formvalidator/Element/datepickerdate.php +++ b/main/inc/lib/formvalidator/Element/datepickerdate.php @@ -1,25 +1,5 @@ -_locale[$lang_code]['months_long'] = api_get_months_long(); } $this->_options['format'] = 'dFY '.$popup_link; - $this->_options['minYear'] = date('Y')-1; - $this->_options['maxYear'] = date('Y')+15; + $this->_options['minYear'] = date('Y')-5; + $this->_options['maxYear'] = date('Y')+10; $this->_options['language'] = $lang_code; //$this->_options['addEmptyOption'] = true; //$this->_options['emptyOptionValue'] = 0; diff --git a/main/inc/lib/formvalidator/Element/tbl_change.js.php b/main/inc/lib/formvalidator/Element/tbl_change.js.php index 72cad1569b..0a03f465fc 100755 --- a/main/inc/lib/formvalidator/Element/tbl_change.js.php +++ b/main/inc/lib/formvalidator/Element/tbl_change.js.php @@ -1,5 +1,5 @@ var day; @@ -27,11 +27,13 @@ function openCalendar(form, field) { if (regex.test(forminputs[i].getAttribute('name'))) { datevalues[dateindex++] = forminputs[i].value; } - } + } window.open("formvalidator/Element/calendar_popup.php", "calendar", "width=260,height=230,status=no"); day = datevalues[0]; month = datevalues[1]; year = datevalues[2]; + + month--; formName = form; fieldName =field; @@ -162,6 +164,7 @@ function initCalendar() { * @param string date text */ function returnDate(d,m,y) { + formblock= window.opener.document.getElementById(window.opener.formName); forminputs = formblock.getElementsByTagName('select'); var datevalues = new Array(); @@ -169,24 +172,25 @@ function returnDate(d,m,y) { for (i = 0; i < forminputs.length; i++) { // regex here to check name attribute var regex = new RegExp(window.opener.fieldName, "i"); - if (regex.test(forminputs[i].getAttribute('name'))) { - datevalues[dateindex++] = forminputs[i]; + if (regex.test(forminputs[i].getAttribute('name'))) { + datevalues[dateindex] = forminputs[i]; + dateindex++; window.close(); } } - - datevalues[0].selectedIndex = (d-1) ; + datevalues[0].selectedIndex = (d-1) ; datevalues[1].selectedIndex = m; + date = new Date(); - year = 1900; - datevalues[2].selectedIndex = (y-year); - - for(i = 0; i<= 3; i++) - { + + //Selecting the first option of the year + year = datevalues[2].options[0].value; + + datevalues[2].selectedIndex = y - year; + for(i = 0; i<= 3; i++) { attributes = datevalues[i].attributes; for (attr=0; attr