QuickForm无法正常工作,因为无法读取“未定义”

时间:2016-03-18 21:28:44

标签: meteor meteor-autoform

无法弄清楚为什么我的quickForm无法正常工作。

我的代码:

<template name="newTrip">
  <div class="container">
    <div class="row">
      <div class="col s12">
        <div class="card">
          <div class="card-content">
            {{> quickForm id="insertTripForm" type="insert" collection="Trips" fields="tripName, destinations"}}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

在客户端文件夹中,我还有autoform.js,其中包含以下两行:

AutoForm.setDefaultTemplate('materialize');
AutoForm.debug();

没有抛出服务器端错误,在chrome上的开发控制台上,我看到了:

Exception in template helper: TypeError: Cannot read property 'autoform' of undefined
    at http://localhost:3000/packages/aldeed_autoform.js?b3aa1a45a8c57d1da1124520538d2cb9fa458509:6819:14
    at http://localhost:3000/packages/underscore.js?46eaedbdeb6e71c82af1b16f51c7da4127d6f285:169:29
    at _.each._.forEach (http://localhost:3000/packages/underscore.js?46eaedbdeb6e71c82af1b16f51c7da4127d6f285:157:22)
    at Function._.map._.collect (http://localhost:3000/packages/underscore.js?46eaedbdeb6e71c82af1b16f51c7da4127d6f285:168:5)
    at getFieldsWithNoGroup (http://localhost:3000/packages/aldeed_autoform.js?b3aa1a45a8c57d1da1124520538d2cb9fa458509:6817:18)
    at Object.quickFormContext (http://localhost:3000/packages/aldeed_autoform.js?b3aa1a45a8c57d1da1124520538d2cb9fa458509:6716:27)
    at http://localhost:3000/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:2986:16
    at http://localhost:3000/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:1650:16
    at http://localhost:3000/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3038:66
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?9391df93ba5076c2cfc61ee68724eb79b65f00d9:3671:12)
debug.js:41 Exception from Tracker recompute function:
debug.js:41 TypeError: Cannot read property 'id' of undefined
    at null.<anonymous> (autoForm.js:73)
    at view.js:199
    at Function.Template._withTemplateInstanceFunc (template.js:457)
    at view.js:197
    at Object.Blaze._withCurrentView (view.js:538)
    at viewAutorun (view.js:196)
    at Tracker.Computation._compute (tracker.js:323)
    at new Tracker.Computation (tracker.js:211)
    at Object.Tracker.autorun (tracker.js:562)
    at Blaze.View.autorun (view.js:209)

我做错了什么?我之前使用过quickForms,现在无法弄清楚我在做什么!

感谢您的帮助!

0 个答案:

没有答案