-
Notifications
You must be signed in to change notification settings - Fork 2
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
QOL-8650 add webhooks and update readme #16
QOL-8650 add webhooks and update readme #16
Conversation
devonpis
commented
Apr 8, 2022
- update readme
- add window.formioCreateFormOptions to FormioLoader for passing createForm custom options
- add window.formioCreateFormController to FormioLoader to expose formio form object
...defaultOptions, | ||
// combine with webhook options | ||
...(window.formioCreateFormOptions | ||
? window.formioCreateFormOptions({ ...opts, defaultOptions }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this does not handle two 'scripts' trying to set this function?
How could we allow that to occur?
Also is this per form creation or only at start.
i.e. if i 'replace' the formioCreateFormOptions function and then manually load a new form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it will overwrite each other if set in 2+ different scripts... i probably need to to use another approach to support that
with either approach the hook function only need to defined once, but no harm to define multiple times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also;
would you need to have your script 'init' prior to the loader kicking off
OR
before it reaches the div data element/code that creates the form?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the hook functions could be placed anywhere in the page, but need to be defined before the the loader is initiated
ie.
<div data-formio ... />
<script>
window.formioCreateFormOptionsHook = ()=> { return blah } OR window.formioCreateFormOptions["envUrl"]["projectId"]["formId"] (new approach for specific form)
window.formioCreateFormControllerHook = ()=> { blah() } OR window.formioCreateFormController["envUrl"]["projectId"]["formId"] (new approach for specific form)
FormioLoader.initFormio() OR FormioLoader.initFormioInstance()
</script>
or
<div data-formio ... />
<script>
window.formioCreateFormOptionsHook = ()=> { return blah } OR window.formioCreateFormOptions["envUrl"]["projectId"]["formId"] (new approach for specific form)
window.formioCreateFormControllerHook = ()=> { blah() } OR window.formioCreateFormController["envUrl"]["projectId"]["formId"] (new approach for specific form)
</script>
<script src=".../formio-script.js" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may need that in the doc's