Meteor-Community-Packages / meteor-autoform

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

Closed yzalvov closed 3 years ago

yzalvov commented 6 years ago

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:

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 })
jankapunkt commented 3 years ago

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