How to access a calander object from array

Hi ,

Below is my code snippet

/* dhtmlxCalander fields*/
var hyCalendar;
var DATE_TO_ADD = 20;

var calanderArray = new Array(“maturityDate”,
“firstCallDate”,
“callScheduleDate0”,
“callScheduleDate1”,
“callScheduleDate2”,
“callScheduleDate3”,
“callScheduleDate4”);

function createCalendarInstance(calanderArray) {
if (typeof calanderArray === “undefined”) {
return;
}

if(calanderArray.length === 0) {
	return;	
}

var mycalendarArray = "['";
mycalendarArray = mycalendarArray +  "" + calanderArray.join("','");
mycalendarArray = mycalendarArray + "" + "']";

hyCalendar = new dhtmlxCalendarObject(eval(mycalendarArray), true, {
    isYearEditable: true
});

var d = new Date();
var curr_year = d.getFullYear();

hyCalendar.setYearsRange(curr_year - DATE_TO_ADD, curr_year + DATE_TO_ADD);									   
hyCalendar.setDateFormat("%m/%d/%Y");

}

How can i show and hide based on array passed above

function calendarFocusHandler(name) {

nothing from below commented code works
/*
document.getElementById(name).show()

alert(hyCalendar[1])
alert(hyCalendar['firstCallDate'])
//firstCallDate.show();
this.dhtmlXCalendarObject['firstCallDate'].show()

*/
}

function calendarBlurHandler(name) {
document.getElementById(name).hide()
}

You can hide calendar by
hyCalendar.hide();
But there is no way to show calendar and specify at each input it must be rendered at the same time. Calendar is linked to target inputs and will appear automatically , after clicking related input.

If you need more detailed control over behavior, you need to create separate calendar controls for each area.

Hello Stan,

I seperated out each calendar creation, what i want now is onfocus of a textbox associated with calander i want it to show and onblur it should hide, how can i achieve it.

should i write onfocus for each textbox if yes how will i get the pobject refrerence of calendar.

Appreciate your help.

Hi Stan,

I was able to achive that as well. but another problem now i face is “onfocus” of textbox the calander is drawn, after i select the date the tab index is lost, it doent go to the next element in the page.

how should i achieve this.

Apreciate your help

Best regards
E178401

Check the attached sample
1282132167.zip (36.6 KB)

Hi Stan,

The Example zip you gave, open on focus of textbox, thanks for this. but when selection of a date ,it doesn’t populate the corresponding TextBox.

Appreciate if you can help us out.

Best Regards
E178401

we found the solution, we modified the existing js to make it work for our usecase. thanks all