How to use JavaScript Promises with GoodForms

Created by Alison Gianotto, Modified on Fri, 5 Feb, 2021 at 2:50 PM by Alison Gianotto

If you’re trying to integrate Promises with your goodforms.com code, it shouldn’t be too hard because of our asynchronous function support. As a start, here’s an example:


goodforms('form_key', {
    onWhatever: function (something,callback) {
        your.stream.of.promises.then(function () {
            //your code here
        }).then(function (resolved_value) {
            // success! Everything resolved
            callback(resolved_value);
        }).else(function (err) {
            // error! Something failed in the stream of promises
            callback(false);
        })
    }
})


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article