Expanding Forms containing dhtmlxCalendarObject

I’m designing a form that will have a variable number of rows of input fields. My script successfully creates new date-input fields and associated dhtmlxCalendarObject scripts (with incremented ids and variable names), but the calendar does not appear on the cloned rows.

Here’s the function that creates a clone when a user clicks the “Add Row” button. The first (static) date field has an id of “DATE01” and an object of “mCal.” The next (cloned) date field is id “DATE02” and object “mCal2”, etc.

What am I doing wrong? Thanks in advance.

You can use following code as more easiest way to dynamically creation of the calendars:

var newCalId = ‘mCal’ + newRowCount;
window [newCalId] = new dhtmlxCalendarObject(‘DATE0’ + newRowCount);
window [newCalId].setSkin(“yahoolike”);
window [newCalId].setDateFormat("%m/%d/%Y");
window [newCalId].draw();


var dateScript = rowNodeClone.getElementsByTagName(“script”).item(0);

dateScript.text = ‘mCal’ + newRowCount + ’ = new
dhtmlxCalendarObject(“DATE0’ + newRowCount + '”); mCal’ + newRowCount +
‘.setSkin(“yahoolike”); mCal’ + newRowCount +
‘.setDateFormat("%m/%d/%Y"); mCal’ + newRowCount + ‘.draw();’;