Could I add custom value to "Object Field" in "AutoForm"?


#1

I hvae

// Schema
Customer = new SimpleSchema({
    name: {
        type: String
    },
    objField: {
        type: Object // don't want specific fields
    }
});

// Hook
berfor:{
   insert:function(doc){
      if(doc.name == 'A'){
           doc.objField = {key1: val1, key2: val2}
      }else{
           doc.objField = {key1: val1, key2: val2, key3: val3}
      }
      return doc
   }
.............
}