{"action":"created","issue":{"url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/958","labels_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/958/labels{/name}","comments_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/958/comments","events_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/958/events","html_url":"https://github.com/guillaumepotier/Parsley.js/issues/958","id":102451977,"number":958,"title":"Trying to use Promise in Custom Validator","user":{"login":"rtmalone","id":6342154,"avatar_url":"https://avatars.githubusercontent.com/u/6342154?v=3","gravatar_id":"","url":"https://api.github.com/users/rtmalone","html_url":"https://github.com/rtmalone","followers_url":"https://api.github.com/users/rtmalone/followers","following_url":"https://api.github.com/users/rtmalone/following{/other_user}","gists_url":"https://api.github.com/users/rtmalone/gists{/gist_id}","starred_url":"https://api.github.com/users/rtmalone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtmalone/subscriptions","organizations_url":"https://api.github.com/users/rtmalone/orgs","repos_url":"https://api.github.com/users/rtmalone/repos","events_url":"https://api.github.com/users/rtmalone/events{/privacy}","received_events_url":"https://api.github.com/users/rtmalone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-21T19:58:03Z","updated_at":"2015-08-21T20:33:59Z","closed_at":null,"body":"Cool. Ok, so I've got a custom validator working in the strictest sense when `validateString` returns either `true` or `false`. I've noticed in the current docs that validating functions \"can instead return a promise that will be resolved if the value is valid, or be rejected otherwise\". That is what I need to happen, but am having difficulty implementing it. I'm using the native JS Promises like so:\r\n\r\n```\r\nvalidateString: function(){\r\n    var promise = new Promise(function(resolve, reject){\r\n\r\n          confirmEmailAjax(function(boolean){\r\n              if (boolean) {\r\n                  resolve('Yay');\r\n              } else {\r\n                  reject('sad face');\r\n              }\r\n          });\r\n\r\n     });\r\n\r\n    return promise;\r\n},\r\n```\r\n\r\n`confirmEmailAjax` is returning either `true` or `false`. @marcandre can you shed some light on this? Is the promise referenced in the docs utilized differently? If I need to open a thread on this some where else, I'll happily do so. Let me know."},"comment":{"url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/comments/133552058","html_url":"https://github.com/guillaumepotier/Parsley.js/issues/958#issuecomment-133552058","issue_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/958","id":133552058,"user":{"login":"marcandre","id":33770,"avatar_url":"https://avatars.githubusercontent.com/u/33770?v=3","gravatar_id":"","url":"https://api.github.com/users/marcandre","html_url":"https://github.com/marcandre","followers_url":"https://api.github.com/users/marcandre/followers","following_url":"https://api.github.com/users/marcandre/following{/other_user}","gists_url":"https://api.github.com/users/marcandre/gists{/gist_id}","starred_url":"https://api.github.com/users/marcandre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcandre/subscriptions","organizations_url":"https://api.github.com/users/marcandre/orgs","repos_url":"https://api.github.com/users/marcandre/repos","events_url":"https://api.github.com/users/marcandre/events{/privacy}","received_events_url":"https://api.github.com/users/marcandre/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T20:33:59Z","updated_at":"2015-08-21T20:33:59Z","body":"Mmm, we are expecting a jQuery promise, actually. Can you try that?\r\nOn my end I can look and see if we could be compatible with both at little cost."}}