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

QOL-8650 add webhooks and update readme #16

Merged

Conversation

devonpis
Copy link
Contributor

@devonpis 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

@devonpis devonpis requested a review from a team April 8, 2022 04:53
...defaultOptions,
// combine with webhook options
...(window.formioCreateFormOptions
? window.formioCreateFormOptions({ ...opts, defaultOptions })
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Contributor Author

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" />

Copy link
Member

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

@devonpis devonpis merged commit 3b960f8 into release-v1.0.4 Apr 11, 2022
@duttonw duttonw deleted the QOL-8650-final-touch-of-the-formio-squiz-improvement branch April 14, 2022 03:49
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

Successfully merging this pull request may close these issues.

3 participants