1

我有一个可以init运行的 Can JS 模型this.validateNonBlank("title");onblur当我跳出该title字段时,如何触发该验证运行?现在它只在另一个元素触发change事件时触发。

can.Model.Cacheable("CMS.Models.Program", {
  root_object : "program"
  , root_collection : "programs"
  ...
  , links_to : {
    "Regulation" : "ProgramDirective"
    , "Policy" : "ProgramDirective"
    ...
    , "Market" : {}
  }
  , init : function() {
    var that = this;
    this.validateNonBlank("title");
    this._super.apply(this, arguments);
  }
}, {
});

(完整的代码在这里。)

4

0 回答 0