Hi Guys, I am really struggling with this one right here for like 48 hours no stop searching for the right answer. i have tried many solution but none really helped.
The problem is, that the Shema works fine and everything else, but when i click submit nothing really happen.
Please Please Guys I need help please.
Love,
Laurent,
{{#autoForm collection="Message" type="insert" scope="messages" class="form" id="sendMessage"}}
{{> afQuickField name="conversation_id" value=_id}}
<div class="row">
<div class="input-field col s9 l8">
{{> afFieldInput name="message"}}
</div>
<div class="input-field col s3 l4 right-align">
<a type="submit" class="waves-effect waves-green btn btn-flat"><i class="material-icons green-text">send</i></a>
</div>
</div>
{{/autoForm}}
My Schema
import SimpleSchema from 'simpl-schema';
SimpleSchema.extendOptions(['autoform']);
Schema.Message = new SimpleSchema({
conversation_id: {
type: String,
autoform: {
type: 'hidden'
}
},
'conversation_id.$': {
type: String,
autoform: {
type: 'hidden'
}
},
message: {
type: String,
},
// ,
// 'message.$': {
// type: String,
// },
read: {
type: Boolean,
autoValue: function(){
if(this.isInsert){
return false;
}
},
autoform: {
type: 'hidden'
}
},
authorId: AutoValue.author,
createdAt: AutoValue.now
});
Schema.Conversation = new SimpleSchema({
users: {
type: Array,
optional: true,
},
'users.$': {
type: String,
optional: true,
},
read: {
type: Array,
optional: true,
},
'read.$': {
type: String,
optional: true,
},
createdAt: AutoValue.now,
updatedAt: AutoValue.update
});
Message.attachSchema(Schema.Message);
Conversation.attachSchema(Schema.Conversation);
AutoValue = {
now: {
type: Date,
autoValue: function (){
if(this.isInsert){
return new Date();
}
else if(this.isUpsert){
return {$setOnInsert: new Date()};
}
else{
this.unset();
}
},
autoform: {
type: 'hidden'
},
optional: true,
},
update: {
type: Date,
autoValue: function (){
return new Date();
},
autoform: {
type: 'hidden'
},
optional: true,
},
author: {
type: String,
autoValue: function() {
if(this.isInsert){
return this.userId;
}
else{
this.unset();
}
},
autoform: {
type: 'hidden'
},
optional: true,
},
};