Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema

Home Page:https://github.com/Meteor-Community-Packages/meteor-simple-schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

qnreck opened this issue · comments

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

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:

  • Switch to the NPM package. Be sure to adjust for the breaking changes. There can be a lot of work involved in switching, but it is worth the effort.
  • If this issue still occurs in the NPM package, submit an issue there. Be sure to include a link to a reproduction repo or a PR that adds a failing test for the issue.
  • If you have more time than money, submit a pull request to resolve any issue labeled "help wanted" in the NPM package repo.
  • If you have more money than time, donate to help support development if you are able