2017-02-21 63 views
0

使用autoform處理meteor中的註釋表單。AutoForm電子郵件示例後面的錯誤示例:ReferenceError:檢查未定義

[email protected] 
aldeed:autoform 

從了自動文檔,這是我的服務器端功能使用的形式發送電子郵件:

Meteor.methods({ 
sendRequestEmail: function(doc) { 
    console.log("Sending request email..."); 
    // Important server-side check for security and data integrity 
    check(doc, Schemas.RequestForm); 

    // Build the e-mail text 
    var text = "Name: " + doc.name + "\n\n" + 
      "Email: " + doc.email + "\n\n\n\n" + 
      doc.message; 

    this.unblock(); 

    // Send the e-mail 
    Email.send({ 
    to: "[email protected]", 
    from: doc.email, 
    subject: doc.name + " request", 
    text: text 
    }); 
} 
}); 

但這裏是我得到的服務器控制檯錯誤:

Exception while invoking method 'sendRequestEmail' ReferenceError: check is not defined 
at [object Object].sendRequestEmail (server/main.js:13:5) 
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12) 
at packages/ddp-server/livedata_server.js:711:19 
at [object Object]._.extend.withValue (packages\meteor.js:1122:17) 
at packages/ddp-server/livedata_server.js:709:40 
at [object Object]._.extend.withValue (packages\meteor.js:1122:17) 
at packages/ddp-server/livedata_server.js:707:46 
at Session.method (packages/ddp-server/livedata_server.js:681:23) 
at packages/ddp-server/livedata_server.js:551:43 

檢查不是autoform的一部分嗎?

回答

0

原來,沒有檢查不是autoform的一部分。這裏是簡單的修復:

> meteor add check 

哎!

相關問題