formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.88k stars 1.06k forks source link

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

Closed RahulKhandelwal17 closed 4 months ago

RahulKhandelwal17 commented 6 months ago

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 commented 4 months ago

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 commented 4 months ago

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