Skip to content

jsonform does not work when loaded with htmx #70

@mick88

Description

@mick88

jsonform version 2.11.0

I use htmx on my website to show a popup dialog with a form. The popup is triggered with this button:

<a hx-get="/dashboards/edit-widget/75" hx-target="#widget-edit-popup">Edit widget</a>

And loads html dialog containing the following form template:

{% load bootstrap3 %}

{% csrf_token %}
{% bootstrap_form form layout='horizontal' %}
{{ form.media }}

This results with dialog opening correctly and containg the form, but the jsonform widget does not render. The following error is logged in console:

VM155:22 Uncaught ReferenceError: reactJsonForm is not defined
    at initJSONForm (<anonymous>:22:28)
    at <anonymous>:35:9
    at <anonymous>:37:3
    at Ge (htmx.min.js:1:17995)
    at htmx.min.js:1:18122
    at B (htmx.min.js:1:3281)
    at Ke (htmx.min.js:1:18094)
    at htmx.min.js:1:6875
    at htmx.min.js:1:32813
    at B (htmx.min.js:1:3281)

However, if I close the dialog and trigger it the second time, the jsonform widget does render.

I also tried removing dialog out of the equation and just render the form on the page, but same result. jsonform does not render the first time it is triggered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions