AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.
MIT License
1.44k
stars
328
forks
source link
autoValues don't go to a collection from standard 'insert' type of form #1668
For insert type of form autoValues work in a client's console, but don't save to DB. And for update type of form they work fine though.
Worthwhile to note:
I don't attach any SimpleSchema to my form, just referencing to it via schema=stepSchema autoForm param instead. I tried to attach it, but it didn't help.
And I give a form both schema and collection params.
As a workaround now I use my own insert logics with onSubmit hook and normal type of form.
Here's a part of my SS:
Schema.wizardStep1 = new SimpleSchema({
createdAt: {
type: Date,
autoValue: function() {
if (this.isInsert) {
return new Date();
} else if (this.isUpsert) {
return {$setOnInsert: new Date()};
} else {
this.unset();
}
},
},
owner: {
type: String,
autoValue: () => Meteor.userId()
}
}, { tracker: Tracker })
Can't reproduce. Closed. This issue may have been resolved with AutoForm 7.0.0, please migrate to the latest version and reopen in case the issue persist
For
insert
type of formautoValue
s work in a client's console, but don't save to DB. And forupdate
type of form they work fine though.Worthwhile to note:
schema=stepSchema
autoForm param instead. I tried to attach it, but it didn't help.schema
andcollection
params.As a workaround now I use my own insert logics with
onSubmit
hook andnormal
type of form.Here's a part of my SS: