FAQ

Does this library generate form elements?

No, this library does not generate form elements but only the fields. If you are generating fields inside a form element, it is recommended to use the novalidate attribute on the form to prevent browser validation conflicts.

It's also a good practice to use the showValidationErrors method when clicking the submit button to display any validation errors.

Example:

<form novalidate>
  <!-- Your Jedison fields here -->
  <button type="submit" onclick="showValidationErrors()">Submit</button>
</form>

Editor not rendering?

Ensure that:

  • container is a valid DOM element
  • theme is provided
const jedison = new Jedison.Create({
  container: document.getElementById('jedison-container'),
  theme: new Jedison.Theme(),
  schema: mySchema
})

$ref not working?

Use RefParser and call await refParser.dereference(schema) before creating the Jedison instance.

const refParser = new Jedison.RefParser()
await refParser.dereference(schema)

const jedison = new Jedison.Create({
  container: document.getElementById('jedison-container'),
  theme: new Jedison.Theme(),
  refParser: refParser,
  schema: schema
})

Plugin editor not showing?

Check that the external library is loaded. For example, verify that window.Quill or window.flatpickr exists before initialization.

<!-- Load the plugin's library BEFORE Jedison creates the editor -->
<script src="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.js"></script>

<script type="module">
  console.log(typeof window.Quill) // must be 'function', not 'undefined'

  const jedison = new Jedison.Create({
    container: document.getElementById('jedison-container'),
    theme: new Jedison.Theme(),
    schema: {
      type: 'string',
      'x-format': 'quill'
    }
  })
</script>

Validation not working?

For format validation, set assertFormat: true in your Jedison options.

const jedison = new Jedison.Create({
  schema: {
    type: 'string',
    format: 'email'
  },
  assertFormat: true
})

jedison.setValue('not-an-email')
console.log(jedison.getErrors())

Infinite recursion with recursive schemas?

Use x-deactivateNonRequired: true in your schema combined with enablePropertiesToggle: true in your Jedison options.

{
  "type": "object",
  "properties": {
    "parent": {
      "$ref": "#",
      "x-deactivateNonRequired": true
    }
  }
}
const jedison = new Jedison.Create({
  container: document.getElementById('jedison-container'),
  theme: new Jedison.Theme(),
  refParser: refParser,
  schema: schema,
  enablePropertiesToggle: true
})