bjh497
asked on
jqery ui datepicker :- passing variables
Having problems with two datepickers one of which the year dropdown caries the year from the other as it's minimum for year dropdown value.
The following code is executed, the onclose functions are called successfully but the global variable "ch_from_year" is not being altered by the onclose function although it is being used successfully within that function (i.e. it sets the right date for that datepicker but it does not seem to carry the value to the gloabal variable.)
Advice appreciated.
The following code is executed, the onclose functions are called successfully but the global variable "ch_from_year" is not being altered by the onclose function although it is being used successfully within that function (i.e. it sets the right date for that datepicker but it does not seem to carry the value to the gloabal variable.)
var ch_from_year = '1940';
$(function() {
$('#ch_from_date').datepicker({
showOn: 'button',
buttonImage: '../css/images/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
minDate: new Date(1929, 1 - 1, 1),
beforeShowDay: hideDays,
yearRange: '1929:2010',
dateFormat: 'mm-yy',
onClose: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
ch_from_year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(ch_from_year, month, 1));
}
});
});
$(function() {
$('#ch_to_date').datepicker({
showOn: 'button',
buttonImage: '../css/images/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
minDate: new Date(ch_from_year, 1 - 1, 1),
beforeShowDay: hideDays,
yearRange: '1929:2010',
dateFormat: 'mm-yy',
onClose: function(dateText, inst) {
var to_month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var to_year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(to_year, to_month, 1));
}
});
});
Advice appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry we had already fixed it.
ASKER
we solved it internally but htis solution was nearly their.
just to be clear