formio / formio.js

JavaScript powered Forms with JSON Form Builder

Home Page:https://formio.github.io/formio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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