hi meteorites, i’ve problem with this code. i dont know why this code cant work like i see in tutorial.
Template.body.events({
“submit .new-task”: function (event, template) {
// Prevent default browser form submit
event.preventDefault();
// Get value from form element
var text = event.target.text.value;
var name=event.target.name.value;
var place = event.target.place.value;
// Insert a task into the collection
Tasks.insert({
text: text,
name: name,
place: place,
createdAt: new Date() // current time
});
There are many possible causes of this. Most common ones that I can think of:
you removed insecure package but you didn’t define Tasks.allow on server-side so the server refuses to store your data. This will emit Access denied message in your browsers console. Read more here about allow API.
you’re using simple-schema package and the data you’re trying to insert doesn’t match your schema. This will emit an error in the server console which should tell you what the problem is.
Do you see any errors in either browser javascript console, or in the terminal where you ran meteor command? If yes, please paste them here, otherwise it’s impossible for us to investigate the problem.