javascriptmeteormeteor-blazemeteor-autoformsimple-schema

Exception in defer callback: Error: No such template: autoform


Assuming I did everything like aldeed described here to create a custom form template. What did I forget or where is the mistake that the autoform tag is not present?

Actual html examle:

<template name="afType_talkBar">
  {{#autoform schema=Schema.Nachrichten id="sendMessageForm" type="insert"}}
  <fieldset class="clubChat__input">
    <div class="clubChat__message-bar">
        {{> afQuickField name='chatroomId'}}
        {{> afQuickField name='userName'}}
        <div class="form-group{{#if afFieldIsInvalid name='content'}} has-error{{/if}}">
              <div class="input-group">
                <span class="input-group-addon">$</span>
                {{> afFieldInput name='content'}}
                <span class="input-group-addon">/each</span>
              </div>
              {{#if afFieldIsInvalid name='content'}}
              <span class="help-block">{{afFieldMessage name='content'}}</span>
              {{/if}}
        </div>
        <input type="submit" value="{{_ 'chatAction.send'}}">
    </div>
  </fieldset>
  {{/autoform}}
</template>

And the client side talkBar.js

import './talkBar.html';

// Import necessary js Packages
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';

import { Nachrichten } from '../../../api/nachrichten/nachrichten';

Bonus question. Inserting

Template.talkBar.helpers({
  nachrichtenCollection(){
    return Nachrichten;
  }
});

results into an Uncaught TypeError: Cannot read property 'helpers' of undefined

Looks like i'm missing something fundamental


Solution

  • Typo Error instead of autoform it must be autoForm

    Correct code should look like this:

    <template name="afType_talkBar">
      {{#autoForm schema=Schema.Nachrichten id="sendMessageForm" type="insert"}}
      <fieldset class="clubChat__input">
        <div class="clubChat__message-bar">
            {{> afQuickField name='chatroomId'}}
            {{> afQuickField name='userName'}}
            <div class="form-group{{#if afFieldIsInvalid name='content'}} has-error{{/if}}">
                  <div class="input-group">
                    <span class="input-group-addon">$</span>
                    {{> afFieldInput name='content'}}
                    <span class="input-group-addon">/each</span>
                  </div>
                  {{#if afFieldIsInvalid name='content'}}
                  <span class="help-block">{{afFieldMessage name='content'}}</span>
                  {{/if}}
            </div>
            <input type="submit" value="{{_ 'chatAction.send'}}">
        </div>
      </fieldset>
      {{/autoForm}}
    </template>