Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

count returned by incrementCounter is undefined #5

Open
ashersz opened this issue Jun 3, 2015 · 0 comments
Open

count returned by incrementCounter is undefined #5

ashersz opened this issue Jun 3, 2015 · 0 comments

Comments

@ashersz
Copy link

ashersz commented Jun 3, 2015

Hi,
I am trying to add a memberid field with incrementCounter
I get: Error invoking Method 'getCount'
the count value is undefined
I am new to meteor and I could not find a full example with incrementCounter so I may have done something wrong.
Thanks for your help.

I have the following code
if (Meteor.isServer) {
Meteor.methods({
'getCount' : function () {
var count = incrementCounter('memberid');
console.log("count : "+count);
return count;
}
});
}
...
if (Meteor.isClient) {
...
Template.member.helpers({
steps: function() {
return [{
id: 'personal-info',
title: 'Personal Info',
schema: Schema.personalInfo,
// template: 'personalInfo'
}, {
id: 'member-info',
title: 'Member Info',
schema: Schema.memberInfo,
// template: 'memberInfo',
},{
id: 'contact-info',
title: 'Contact Info',
schema: Schema.contactInfo,
// template: 'contactInfo',
onSubmit: function(data, wizard) {
var self = this;
var count = Meteor.call('getCount');
var mydata = .extend(wizard.mergedData(),{memberid:count});
Members.insert(
.extend(mydata, data), function(err, id) {
if (err) {
self.done();
} else {
Router.go('viewMember', {
_id: id
});
}
});
}
}];
}
});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant