Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by jennifer on Jun 25, 2009 15:40
open dhtmlx forum
Scheduler js error in ie for dropdowns

I have come up with an interesting issue. In IE when you click on the edit icon next to an event that is already set up the window for editing doesn't open (though the main screen does dim) and there is a javascript error as follows:

options.[...].key' is null or not an object.

This is not an issue nor is an error returned in firefox or opera.

The code I use in the html init function si as follows:
function init() {
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.lightbox.sections=[
{name:"description", height:42, map_to:"text", type:"textarea" , focus:true},
{name:"details", height:130, type:"textarea", map_to:"cal_event_desc" },
{name:"time", height:72, type:"time", map_to:"auto"},
{name:"priority", height:42, width:150, type:"select", map_to:"cal_event_priority",
options:[
{key:1, label:"Normal"},
{key:2, label:"Moderate"},
{key:3, label:"Critical"}
]
},
{name:"is_recurring", height:42, type:"select", map_to:"is_recurring",
options:[
{key:1, label:"This time only"},
{key:2, label:"Daily"},
{key:3, label:"Weekly"},
{key:4, label:"Every 2 Weeks"},
{key:5, label:"Monthly"},
{key:6, label:"Quarterly"}
]
},
{name:"recurrence_span", height:42, type:"select", map_to:"recurrence_span",
options:[
{key:1, label:"The next month"},
{key:2, label:"The next 6 weeks"},
{key:3, label:"The next 3 months"},
{key:4, label:"The next 6 months"},
{key:5, label:"The next year"},
]
},
{name:"has_reminder", height:42, type:"select", map_to:"has_reminder",
options:[
{key:1, label:"no reminder"},
{key:2, label:"5 minutes before"},
{key:3, label:"10 minutes before"},
{key:4, label:"15 minutes before"},
{key:5, label:"20 minutes before"},
{key:6, label:"30 minutes before"},
{key:7, label:"45 minutes before"},
{key:8, label:"1 hour before"},
{key:9, label:"2 hours before"},
{key:10, label:"3 hours before"},
{key:11, label:"4 hours before"},
{key:12, label:"5 hours before"},
{key:13, label:"6 hours before"},
{key:14, label:"7 hours before"},
{key:15, label:"8 hours before"},
{key:16, label:"9 hours before"},
{key:17, label:"10 hours before"},
{key:18, label:"11 hours before"},
{key:19, label:"12 hours before"},
{key:20, label:"18 hours before"},
{key:21, label:"1 day before"},
{key:22, label:"2 days before"},
{key:23, label:"3 days before"},
{key:24, label:"4 days before"},
{key:25, label:"5 days before"},
{key:26, label:"1 week before"},
{key:27, label:"2 weeks before"},
{key:28, label:"1 month before"},
]
}
]
scheduler.config.first_hour=8;
scheduler.config.hour_date="%h:%i %A";
scheduler.locale.labels.section_description="Event Title";
scheduler.locale.labels.section_details="Event Details";
scheduler.config.details_on_create=true;
scheduler.config.details_on_dblclick=true;
scheduler.locale.labels.section_priority="Event Priority";
scheduler.locale.labels.section_is_recurring="This event reoccurs...";
scheduler.locale.labels.section_recurrence_span="For the next...";
scheduler.locale.labels.section_has_reminder="Email me a reminder of this event...";

scheduler.locale.labels.task_tab="Task List";
scheduler.locale.labels.search_tab="Search";

scheduler.update_viewA=scheduler.update_view;

scheduler.update_view = function(){
if (this._mode=="task")
alert("Date:"+this._date+", mode:"+this._mode+" task view will show up below");
else if (this._mode=="search")
alert("Date:"+this._date+", mode:"+this._mode+" search page will show up on this tab");
else return this.update_viewA();
}

scheduler.init('scheduler_here',null,"week");

scheduler.templates.event_class=function(start,end,event){
if (event.cal_event_priority == 1) //if date in past
return "priority_one_event"; //then set special css class for it
else if (event.cal_event_priority == 3) //if date in past
return "priority_normal_event"; //then set special css class for it
else if (event.cal_event_priority == 2) //if date in past
return "priority_medium_event"; //then set special css class for it
}

scheduler.load("events.php?&uid="+scheduler.uid());

var dp = new dataProcessor("events.php");

dp.init(scheduler);
}

on an additional note I am using an updated dhtmlxscheduler.js file that you sent me this morning but I reverted back to the old one and the issue above happens in both.

Would love some feedback as the majority of misguided souls out there still use ie.

Thanks ahead of time.

Jen
Answer posted by Support on Jun 26, 2009 01:41
The above code really will not work in IE7 or below. 
The next lines in your code violate js parsing rules of IE


{key:5, label:"The next year"},
]
...
{key:28, label:"1 month before"},
]


There must not be a comma after last element of an array. 
Answer posted on Jun 26, 2009 10:36
You are indeed corrct.... thank you for the pointer... was not there in the first two and because I generate the array dynamically I did not notice that i had not doen a rtrim to get rid of that last ,.  I really do appreciate your response and the added set of eyes! :)

Jen