Best practice for Meteor AutoForm validation of items not in the form?


AutoForm works great when you want to validate a form using the schema, but oftentimes the form doesn’t contain all the data that’s in the schema, so you get a validation error.

For example, I have a submit button that is disabled until it determines the form is completely valid, but because the form doesn’t contain all the data that’s in the schema, it can never show that it’s completely valid.

Say that you’ve got a schema

ShoppingCartSchema = new SimpleSchema({
  itemsOrdered: {
    type: [Object],
    optional: false,
  totalPrice: {
    type: Number,
    optional: false,
  customerAddress: {
    type: Object,
    optional: false
  systemGeneratedInfo: {
    type: Object,
    optional: true,
    blackbox: true


My form code would be something like:

{{> quickForm collection="ShoppingCarts" id="shoppingCartForm" type="insert"}}

Obviously you don’t want totalPrice to be an item on the form for the user to fill on their own. systemGeneratedInfo could be an object that your code generates based on the form values, but which doesn’t appear on the form itself.

You could put totalPrice into a hidden form element but that seems sketchy. You really wouldn’t want to do that with systemGeneratedInfo.

What other strategies would there be for tackling items on the object that don’t show up on the form, but which still allow the form shown on the front end to be completely validated?