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

"Formio.createForm" method return error when Input option parameter "components" provided #5538

Closed
RahulKhandelwal17 opened this issue Mar 18, 2024 · 2 comments

Comments

@RahulKhandelwal17
Copy link

Describe the bug
When I'm creating a form with input option parameter "components" form doesn't render.

Below code run on perfectly fine https://jsfiddle.net/travistidwell/6uge153s/

Formio.createForm(document.getElementById('formio'), 'https://exampleapp.form.io/renderertest', {
readOnly: false,
hide: {"firstName": true},
////components: { "textfield": { "prefix": "hello" }},
disabled: {"lastName": true},
buttonSettings: { "showSubmit": false }
});

But when uncomment below code
components: { "textfield": { "prefix": "hello" }},

form doesn't get render and I'm getting below error in console.
"TypeError: this.getComponents(...).slice is not a function" error in console.

As per the documentation (screen-shot attached) I'm passing the right data in components.
documentationPage

Version/Branch
https://github.com/formio/formio.js/tree/v5.0.0-rc.2

To Reproduce
Steps to reproduce the behavior:

  1. Create form using method "Formio.createForm"
  2. While creating form pass option parameter "components" which allows for overrides for certain components rendered.
  3. Form doesn't get rendered.
  4. See error on console.

Expected behavior
Form should be rendered.
WithoutError
WithError

@lane-formio
Copy link
Contributor

I am able to reproduce this and have created an internal ticket for review. In the meantime, if anyone would like to attempt to tackle this, we always welcome any contributions to our open source!

For internal reference: FIO-8345

@lane-formio
Copy link
Contributor

lane-formio commented May 13, 2024

@RahulKhandelwal17
After review it was determined the documentation is inaccurate. This particular option/override is not valid and will be removed from the docs.

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