Hi,
I am getting “TypeError: elem is undefined” error in the Firebug as soon as I click inside my dhtmlxCalendar field in dhtmlxscheduler custom lightbox. Please see picture for more details. Moreover, I have following questions :
[b]How can I check for a new event or an old event and where should this code go(which event handler)?
How can I restrict users from creating more than 1 event per day? [/b]
scheduler.locale.labels.timeline_tab = "Timeline" //This is for a timeline_tab
scheduler.locale.labels.section_Assessor = "Assessor"; // This is a section in a lightbox
scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.drag_move = false;
scheduler.config.show_loading = true;
scheduler.config.xml_date = "%Y-%m-%d %H:%i";
scheduler.config.start_on_monday = true;
scheduler.createTimelineView({
name: "TopTimeline",
x_unit: "day",
x_date: "%D, %d %M %y ",
x_step: 1,
x_size: 7,
y_unit: AssessorsArray,
y_property:"UserID",
render:"bar"
});
scheduler.form_blocks["my_editor"]={
render:function(sns){
return "<div class='dhx_cal_ltext' style='height:750px;'> <table width='650px' cellspacing='3'> <tbody> <tr> <td class='LightBoxHeadingCell'> Association : </td> <td> <select name='AssociationDropDown' id='AssociationDropDown' onchange='AssociationDropDownOnChange();'> <option selected = '' value='EvaluatorsOffice'>Evaluators Office</option> <option value='Clinic'>Clinic</option> </select> </td> </tr> <tr id='StatusRow'> <td class='LightBoxHeadingCell'> Status : </td> <td> <select style='width:150px' name='StatusDropDown' id='StatusDropDown'> <option selected = '' value='Available'>Available</option> <option value='UnAvailable'>UnAvailable</option> </select> </td> </tr> <tr id='ReasonRow'> <td class='LightBoxHeadingCell'> Reason : </td> <td> <select style='width:150px' name='ReasonDropDown' id='ReasonDropDown'> <option selected = '' value='PersonalLeave'>Personal Leave</option> <option value='Sick'>Sick</option> <option value='StatHoliday'>Stat Holiday</option> <option value='Sick'>Sick</option> <option value='Training'>Training</option> <option value='Vacation'>Vacation</option> </select> </td> </tr> <tr id='ReserveTypeRow'> <td class='LightBoxHeadingCell'> Reserve Type : </td> <td> <select style='width:150px' id='ReserveTypeDropDown' name='ReserveTypeDropDown'> <option selected = '' value='Regular'>Regular</option> <option value='All Call'>All Call</option> </select> </td> </tr> <tr id='ReservedForRow'> <td class='LightBoxHeadingCell'> Reserved For : </td> <td> <select style='width:150px' id='ReservedForDropDown' name='ReservedForDropDown'> <option selected = '' value='Any'>Any</option> <option value='CAT Only'>CAT Only</option> <option value='In-Person Only'>In-Person Only</option> </select> </td> </tr> <tr id='StartCalendarRow'> <td class='LightBoxHeadingCell' id='StartDateLabel'> Start Date : </td> <td> <input type='text' id='StartDateCalendar1'> </td> </tr> <tr id='EndDatesCalendarRow'> <td class='LightBoxHeadingCell'> End Date : </td> <td> <input type='text' id='EndDateCalendar'> </td> </tr> <tr id='AvailableTimesRow'> <td colspan='2'> <table width='500px' cellspacing='1' style='margin-top: 5px;border: 1px solid black;' id='AvailableTimesTable'> <tbody> <tr> <td colspan='2' class='LightBoxHeadingCell'> Available Times : </td> </tr> <tr> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0800_0830'>08:00 - 08:30 AM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0830_0900'>08:30 - 09:00 AM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0900_0930'>09:00 - 09:30 AM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0930_1000'>09:30 - 10:00 AM </td> </tr> <tr> <td class='AvailableTimes'> <input type='checkbox' id='Chk_1000_1030'>10:00 - 10:30 AM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_1030_1100'>10:30 - 11:00 AM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_1100_1130'>11:00 - 11:30 AM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_1130_1200'>11:30 - 12:00 PM </td> </tr> <tr> <td class='AvailableTimes'> <input type='checkbox' id='Chk_1200_1230'>12:00 - 12:30 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_1230_0100'>12:30 - 01:00 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0100_0130'>01:00 - 01:30 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0130_0200'>01:30 - 02:00 PM </td> </tr> <tr> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0200_0230'>02:00 - 02:30 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0230_0300'>02:30 - 03:00 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0300_0330'>03:00 - 03:30 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0330_0400'>03:30 - 04:00 PM </td> </tr> <tr> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0400_0430'>04:00 - 04:30 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0430_0500'>04:30 - 05:00 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0500_0530'>05:00 - 05:30 PM </td> <td class='AvailableTimes'> <input type='checkbox' id='Chk_0530_0600'>05:30 - 06:00 PM </td> <td class='AvailableTimes'> </td> <td class='AvailableTimes'> </td> </tr> </tbody> </table> </td> </tr> <tr id='AssessorNotesRow'> <td valign='top' class='LightBoxHeadingCell'> Assessor Notes : </td> <td> <textarea name='AssessorNotes' style='border: solid 1px #CCC;width:350px;height:70px;font-size: 12px;' id='AssessorNotes'> </textarea> </td> </tr> <tr id='AssessmentsDivRow'> <td colspan='2' class='LightBoxHeadingCell'> <span>Assessments :</span> <div id='AssessmentsGrid' style='margin-top:5px;width:500px;'> </div> </td> </tr> <tr id='NotesRow'> <td valign='top' class='LightBoxHeadingCell'> Notes : </td> <td> <textarea name='Notes' style='border: solid 1px #CCC;width:350px;height:70px;font-size: 12px;' id='Notes'> </textarea> </td> </tr> </tbody> </table> </div>";
},
set_value:function(node,value,ev){
var myCalendar = new dhtmlXCalendarObject(['StartDateCalendar1','EndDateCalendar']);
myCalendar.hideTime();
$('#StartDateCalendar1').val(ev.StartDate || "");
$('#EndDateCalendar').val(ev.EndDate || "");
$("#ReasonDropDown option:contains(" + ev.Reason + ")").attr('selected', 'selected');
$("#ReserveTypeDropDown option:contains(" + ev.ReserveType + ")").attr('selected', 'selected');
$("#ReservedForDropDown option:contains(" + ev.ReservedFor + ")").attr('selected', 'selected');
$('#AssessorNotes').val(ev.AvailabilityNote || "");
$('#Notes').val(ev.BookingNote || "");
$('#AvailableTimesTable input:checkbox').attr('checked','');
if(ev.AvailableTimes)
{
if(ev.AvailableTimes.indexOf('08:00 AM - 08:30 AM') > -1)
$('#Chk_0800_0830').attr('checked','checked');
if(ev.AvailableTimes.indexOf('08:30 AM - 09:00 AM') > -1)
$('#Chk_0830_0900').attr('checked','checked');
if(ev.AvailableTimes.indexOf('09:00 AM - 09:30 AM') > -1)
$('#Chk_0900_0930').attr('checked','checked');
if(ev.AvailableTimes.indexOf('09:30 AM - 10:00 AM') > -1)
$('#Chk_0930_1000').attr('checked','checked');
if(ev.AvailableTimes.indexOf('10:00 AM - 10:30 AM') > -1)
$('#Chk_1000_1030').attr('checked','checked');
if(ev.AvailableTimes.indexOf('10:30 AM - 11:00 AM') > -1)
$('#Chk_1030_1100').attr('checked','checked');
if(ev.AvailableTimes.indexOf('11:00 AM - 11:30 AM') > -1)
$('#Chk_1100_1130').attr('checked','checked');
if(ev.AvailableTimes.indexOf('11:30 AM - 12:00 PM') > -1)
$('#Chk_1130_1200').attr('checked','checked');
if(ev.AvailableTimes.indexOf('12:00 PM - 12:30 PM') > -1)
$('#Chk_1200_1230').attr('checked','checked');
if(ev.AvailableTimes.indexOf('12:30 PM - 01:00 PM') > -1)
$('#Chk_1230_0100').attr('checked','checked');
if(ev.AvailableTimes.indexOf('01:00 PM - 01:30 PM') > -1)
$('#Chk_0100_0130').attr('checked','checked');
if(ev.AvailableTimes.indexOf('01:30 PM - 02:00 PM') > -1)
$('#Chk_0130_0200').attr('checked','checked');
if(ev.AvailableTimes.indexOf('02:00 PM - 02:30 PM') > -1)
$('#Chk_0200_0230').attr('checked','checked');
if(ev.AvailableTimes.indexOf('02:30 PM - 03:00 PM') > -1)
$('#Chk_0230_0300').attr('checked','checked');
if(ev.AvailableTimes.indexOf('03:00 PM - 03:30 PM') > -1)
$('#Chk_0300_0330').attr('checked','checked');
if(ev.AvailableTimes.indexOf('03:30 PM - 04:00 PM') > -1)
$('#Chk_0330_0400').attr('checked','checked');
if(ev.AvailableTimes.indexOf('04:00 PM - 04:30 PM') > -1)
$('#Chk_0400_0430').attr('checked','checked');
if(ev.AvailableTimes.indexOf('04:30 PM - 05:00 PM') > -1)
$('#Chk_0430_0500').attr('checked','checked');
if(ev.AvailableTimes.indexOf('05:00 PM - 05:30 PM') > -1)
$('#Chk_0500_0530').attr('checked','checked');
if(ev.AvailableTimes.indexOf('05:30 PM - 06:00 PM') > -1)
$('#Chk_0530_0600').attr('checked','checked');
}
},
get_value:function(node,ev){
},
focus:function(node){
var a = node.childNodes[1]; a.select(); a.focus();
}