Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema
https://github.com/Meteor-Community-Packages/meteor-simple-schema
MIT License
919 stars 161 forks source link

Can't make "Asynchronous Custom Validation on the Client" to work #700

Closed qnreck closed 6 years ago

qnreck commented 7 years ago

I tried to use "Asynchronous Custom Validation on the Client" with my project, but it always fail for finding my server method on client side

attachmentIds: { type: Array }, 'attachmentIds.$': { type: String, custom: function () { if (Meteor.isClient && this.isSet) { Meteor.call("searchAttachment", { name: 'att1' }, (err, res) => { console.log("RESULT att::", this.value, err, res); // do smth }); } else { return Attachments.find(this.value).count() ? null : 'invalid'; } } }

With above code, result of Meteor.call('searchAttachment', ....) always undefined, and that searchAttachment method never run. Put that coded out of IF clause and it will works. I don't know if it is the correct way to use it or not. Please help. Thanks.

Meteor: 1.4.4.1

aldeed commented 6 years ago

The Meteor SimpleSchema package is no longer maintained other than critical fixes to keep it running with each latest Meteor release. Closing non-critical issues in this repo. Anyone who cares about this may do one or more of the following: