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

How do the events work? #94

Open
shabaz-ejaz opened this issue Sep 26, 2017 · 2 comments
Open

How do the events work? #94

shabaz-ejaz opened this issue Sep 26, 2017 · 2 comments
Assignees
Labels
bug documentation missing required documentation

Comments

@shabaz-ejaz
Copy link

shabaz-ejaz commented Sep 26, 2017

Sorry to be asking obvious questions but I'm not quite sure how the onSave event works and where to put it exactly. Can you show me an example of the onSave function that shows the data?

This is how I have done it:

const options = {
            container: ReactDOM.findDOMNode(this.refs.builder),
            svgSprite: 'https://draggable.github.io/formeo/assets/img/formeo-sprite.svg',
            i18n: {
                langsDir: '/assets/lang/',
                langs: [
                    'en-US',
                ],
            },
            onSave: (evt) => {
                const attr = window.prompt(evt.message.attr);
                let val;
                if (attr) {
                    val = String(window.prompt(evt.message.value, ''));
                    evt.addAction(attr, val);
                }
            }
        };

But it doesn't do anything at all.

@jonamariya
Copy link

You should move onSave inside events sections like this
const options = {
i18n: {
},
events: {
onSave: (evt) => {console.log('saving::'+this.formeo.formData)},
}
}

@nacimgoura
Copy link

nacimgoura commented Jul 6, 2018

There is a problem, onSave is called each time we add an element, it has the same operation as onAdd.

@kevinchappell kevinchappell added the documentation missing required documentation label Jul 16, 2018
@kevinchappell kevinchappell self-assigned this Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug documentation missing required documentation
Projects
None yet
Development

No branches or pull requests

4 participants