I am getting following error when going to view sample form in my react code, any idea about it ?
Unhandled Rejection (Error): form field of type not supported
import { createForm } from '@bpmn-io/form-js';
const form = createForm({
schema,
data,
container: '#form'
});
Anyone have more examples usage of bpmn-io/form-js, at the moment it has very few samples?
Thanks in Advance
Andr3s
August 19, 2021, 5:12am
2
Try with this schema:
const schema = {
schemaVersion: 3,
exporter: {
name: "form-js (https://demo.bpmn.io)",
version: "0.3.0"
},
components: [
{
key: "name",
label: "Text Field",
type: "textfield",
id: "Field_1jfqw1v",
description: "Enter your name ...",
validate: {
required: true,
minLength: 3,
maxLength: 50
}
}
],
type: "default",
id: "Form_1f88rws"
}
I had the same problem, and there was no documentation.
nikku
August 23, 2021, 1:37pm
3
This is likely because you’re passing the schema
as a string or pass a null
schema.
We’re not 100% done with that API yet and may improve its developer friendlyness in the future. One thing it definitely lacks is proper error handling (in the sense of meaningful error messages on miss-use).
I’ve created a GitHub issue to track this:
opened 01:15PM - 23 Aug 21 UTC
enhancement
ux
__Is your feature request related to a problem? Please describe__
Importing a… form schema requires the schema to be already parsed as in `JSON.parse`. This is different from our other toolkits where passing the raw thing (XML string) is enough.
__Describe the solution you'd like__
There is a few things to consider here, i.e. does it make sense to force a user to parse the document herself, if she is not interested in the file format at all? We're going a different path in our other libraries (string in, string out) that I tend to find better suited.
The obvious easy pick is of course to properly indicate miss-use with better error messages.
__Additional context__
Applies to all form-js versions `<= 5`.
1 Like
I had the same problem, and I could solve it
the property “type” was missing in the schema
const schema = {
components: [ ]
type: "default",
}
Please, provide a better indication of the errors
1 Like