"Formio.createForm" method return error when Input option parameter "components" provided
RahulKhandelwal17 opened this issue · comments
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.
Version/Branch
https://github.com/formio/formio.js/tree/v5.0.0-rc.2
To Reproduce
Steps to reproduce the behavior:
- Create form using method "Formio.createForm"
- While creating form pass option parameter "components" which allows for overrides for certain components rendered.
- Form doesn't get rendered.
- See error on console.
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
@RahulKhandelwal17
After review it was determined the documentation is inaccurate. This particular option/override is not valid and will be removed from the docs.