Hi,this is my code:
$$(“scheduler”).data.attachEvent(“onbeforeAdd”,function(id,event){
var text = event.text;
if(text == null ||text == “”){
dhx.ui.alert({
message:“事件不能为空”,
title:“提示”
});
return false;
}
);
when text is empty,the first time I click the save button,it worked and turn to the shceduler view,but,the next time,i click “add” button to create a new scheduler,when i click the “save” button ,the scheduler can be saved to db,at the same time,i get an error:“Uncaught TypeError at dhxscheduler_mobile_rec.js:9” and can’t turn to scheduler view.
Hi,
possibly your code can be corrected like so:
$$("scheduler").data.attachEvent("onbeforeAdd",function(id,event){
var text = event.text;
if(text == null ||text == ""){
dhx.ui.alert({
message:"事件不能为空",
title:"提示"
});
return false;
}
return true;
});
Hi Alexandra
I tried it and it doesn’t work.
$$("scheduler").data.attachEvent("onbeforeAdd",function(id,event){
var text = event.text;
if(text == null ||text == ""){
dhx.ui.alert({
message:"事件不能为空",
title:"提示"
});
return false;
}
var details = event.details;
var start_date = event.start_date;
var end_date = event.end_date;
var rec_type = event.rec_type;
if(rec_type == null){
rec_type ="";
}
var event_length = event.event_length;
var param = {
text:text,
details:details,
start_date:dhx.Date.dateToStr("%Y-%m-%d %H:%i",true)(start_date),
end_date:dhx.Date.dateToStr("%Y-%m-%d %H:%i",true)(end_date),
rec_type:rec_type,
event_length:event_length,
schedulerType:schedulerType,
}
dhx.ajax().post(serverPath+"scheduler/saveScheduler.htm",param,function(text){
event.event_id = text;
});
return true;
});
hello?
Hi,
Please check your code. If you are sure that the problem is caused by our library, please attach a complete demo (the demo should not include server-side scripts).