formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Formio.builder is not a function Error

Open priya30m opened this issue 2 years ago • 1 comments

I am trying to get my custom component included in formio builder navigation bar. I am using below code, however Formio.builder is giving error - Uncaught TypeError: Formio.builder is not a function"

Is there anything missing?

<link rel="stylesheet" href="https://cdn.form.io/js/formio.full.min.css">
<script src="https://cdn.form.io/js/formio.full.min.js"></script>
<div id="builder"></div>
Formio.builder(document.getElementById('builder')
...
...
)

priya30m avatar Oct 12 '23 13:10 priya30m

Ran into same problem. I think they haven't updated the documentation. This worked for me using npm package, might work for CDN too.

import { FormBuilder } from "formiojs";
new FormBuilder(document.getElementById('builder'), {}, {});

Plonq avatar Feb 26 '24 00:02 Plonq

The links for the script and link tag are missing the prefix formio before the js. The html should look like the following

<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdn.form.io/formiojs/formio.full.min.css'>
<script src='https://cdn.form.io/formiojs/formio.full.min.js'></script>
<div id="builder"></div>

with the javascript being Formio.builder(document.getElementById('builder'),{},{}); For more information on how to create custom component please refer to our help docs

ZenMasterJacob20011 avatar Jun 26 '24 14:06 ZenMasterJacob20011