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

Feat: Add configurable events to interact with frontend app #938

Closed
amit-s19 opened this issue Jul 21, 2023 · 2 comments
Closed

Feat: Add configurable events to interact with frontend app #938

amit-s19 opened this issue Jul 21, 2023 · 2 comments

Comments

@amit-s19
Copy link

Is your feature request related to a problem? Please describe.

When integrating Enketo Forms with frontend applications made on React, Angular, plain html css etc it becomes for these apps to interact with the form directly.

Describe the solution you'd like

Events should be provided by default like onFormChange, onSubmit, onSubmitSuccessful, onFailure, onFileUpload, etc which would allow the frontend application to interact with the enketo form.

Describe alternatives you've considered

We've added events manually in controller-webform.js to suit our needs. For example, an event listener was added to events.XFormsValueChanged to listen to form changes event and then data was broadcasted to the frontend application.

  document.addEventListener(events.XFormsValueChanged().type, async (e) => {
        /*
        * Perform actions on event change
        * /
        
       // Broadcast back to frontend
        await formController.broadcastFormDataUpdate(form.getDataStr(), {});
}

Note : This feat/issue is linked to previous issues(s) #940, #939

@lognaturel
Copy link
Contributor

Related to enketo/enketo-express#454

@lognaturel lognaturel transferred this issue from enketo/enketo-express Nov 29, 2023
@lognaturel
Copy link
Contributor

Discussion can continue at #1314

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

2 participants