当用户点击 lightbox(编辑表单)中的“保存”按钮时触发
id | string | 事件的 ID |
ev | object | 一个中间事件对象,包含来自 lightbox 的值 |
is_new | Date | 如果保存的是新事件,则提供该事件的创建日期;如果事件已存在,则为 null |
boolean | 决定是否继续执行默认事件操作(true)或阻止它(false) |
scheduler.attachEvent("onEventSave",function(id,ev,is_new){
if (!ev.text) {
alert("文本不能为空");
return false;
}
if (!ev.text.length<20) {
alert("文本太短");
return false;
}
return true;
})
此事件可以被阻止,非常适合用于验证。当返回 false 时,将阻止默认的保存过程。
请注意:
scheduler.getEvent(id)
返回的是原始状态的事件。