onEventSave

当用户点击 lightbox(编辑表单)中的“保存”按钮时触发

boolean onEventSave(string id,object ev,Date is_new);
idstring事件的 ID
evobject一个中间事件对象,包含来自 lightbox 的值
is_newDate如果保存的是新事件,则提供该事件的创建日期;如果事件已存在,则为 null
boolean决定是否继续执行默认事件操作(true)或阻止它(false

Example

scheduler.attachEvent("onEventSave",function(id,ev,is_new){
    if (!ev.text) {
        alert("文本不能为空");
        return false;
    }
    if (!ev.text.length<20) {
        alert("文本太短");
        return false;
    }
    return true;
})

Related samples

Details

此事件可以被阻止,非常适合用于验证。当返回 false 时,将阻止默认的保存过程。

请注意:

  • 当此事件触发时,lightbox 中的值尚未应用到原始事件,因此 scheduler.getEvent(id) 返回的是原始状态的事件。
  • 'ev' 对象仅包含与 lightbox 中输入对应的属性;例如,如果 lightbox 只有一个输入,'ev' 就只会有那个单一属性。
返回顶部