I made some auto form code
Problem is
autoValue: ->
@_id
is not work..
form are made but not sumited
do you guys know why?
Comments.insert
createAt: new Date
body: tmpl.find('textarea#com').value
todoId: @_id
@Comments = new Mongo.Collection('comments')
Comments.attachSchema new SimpleSchema
comments:
type: String
max: 100
label: 'CommentsBody'
commentsId:
label: 'CommentsId'
type: String
autoValue: ->
@_id
autoform:
omit: true
Your schema and your insert method does not match. Also, doing an autovalue -> @_id is redundant as it will save _id twice, once in the _id field and once in the commentsId. This is the schema that should work with your method:
Comments.attachSchema new SimpleSchema
body:
type: String
max: 100
label: 'CommentsBody'
createAt:
type: Date
autoValue: ->
if @isInsert
new Date()
autoform:
omit: true
todoId:
type: String