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

Save \ Update examples #35

Closed
githubLewis opened this issue Sep 30, 2016 · 1 comment
Closed

Save \ Update examples #35

githubLewis opened this issue Sep 30, 2016 · 1 comment

Comments

@githubLewis
Copy link

githubLewis commented Sep 30, 2016

Are there any plans to update the package with onSave \ onUpdate examples? I've tried a few different ways and I can't get it work, does anyone have a working example?

This is what I have currently, but have tried a few different ways;

$(document).ready(function () {
    new window.Formeo({
        container: '.build-form',
        style: '/assets/css/formeo.min.css',
        debug: true,
        onSave: function() {
            console.log("save");
        }
    });

    console.log("ready!");
});
@tnory56
Copy link

tnory56 commented Nov 10, 2016

Try this:

 var formeoOptions = {
                container: '.build-form',
                events: {
                    onSave: function (formData) {
                        $.ajax({
                            url: <url>,
                            data: {
                                data: formData,
                            },
                            type: 'post',
                            dataType: 'json'
                        }).done(function (response) {
                            console.log(response);
                            alert('data saved');
                        });
                    }
                }
};

            formeo = new Formeo(formeoOptions);

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

3 participants