I've got this strange behavior that the autoform package throws a 404 when i try to submit my form.
I hope i got the install instructions and the basic demo right. I try to provide the needed files. For starters the Schema, Html and the JS File.
Schema (imports/api/footballs/footballs.js):
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
SimpleSchema.extendOptions(['autoform']);
export const Footballs = new Mongo.Collection('footballs');
Footballs.attachSchema (new SimpleSchema({
playerone: {
type: String,
label: 'Player One',
max: 255,
},
playertwo: {
type: String,
label: 'Player Two',
max: 255,
},
gamedate: {
type: Date,
label: 'Game Data',
autoValue: function autoValueCreatedAt() {
return new Date();
},
autoform: {
type: 'hidden'
},
},
},
{tracker: Tracker}));
HTML (imports/ui/pages/stadium.html)
<template name="stadium">
<h1>Lets play kicker!</h1>
{{> quickForm collection=footballCollection id="insertFootballsForm" type="insert" class="newFootballForm"}}
</template>
JS (imports/ui/pages/stadium.js)
import {Footballs} from '../../api/footballs/footballs.js';
import { Template } from 'meteor/templating';
import './stadium.html';
Template.stadium.helpers({
footballCollection(){
return Footballs;
},
});
Thanks to @MasterAM patience, here is the solution. The collection was indeed not present on the server side and therefore had to be imported. Which didn't happend.
Server/main.js
import '../imports/startup/server';
(imports/startup/server/index.js)
import { Footballs } from '../../api/footballs/footballs.js';