You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the upcoming of HTML-over-the-wire like HTMX, Unpoly etc., we are facing new challenges.
I am constructing a generic form that has the possibility of updating itself dynamically, based on django-forms-dynamic - but with HTMX functionality included.
This basically works perfectly with Crispy, with one except: When a conditional field triggers the absence of another field, I must "remove" that field from view. When the field is removed from the form itself, it is not rendered at all, and I don't have a tag with an id as HTMX target any more. I'd like to modifie django-forms-dynamic so that it just "hides" the field.
This only works only with django crispy, as crispy adds a functional wrapper to each field which automatically has a id=div_id_<field-name>.
But, and this is my problem, if crispy renders a "hidden field", it just renders the field without wrapper.
Another possibility would be a DynamicField wrapper for Crispy fields, that holds that possibility, like the equivalent does for form fields in django-forms-dynamic.
With the upcoming of HTML-over-the-wire like HTMX, Unpoly etc., we are facing new challenges.
I am constructing a generic form that has the possibility of updating itself dynamically, based on django-forms-dynamic - but with HTMX functionality included.
This basically works perfectly with Crispy, with one except: When a conditional field triggers the absence of another field, I must "remove" that field from view. When the field is removed from the form itself, it is not rendered at all, and I don't have a tag with an id as HTMX target any more. I'd like to modifie django-forms-dynamic so that it just "hides" the field.
This only works only with django crispy, as crispy adds a functional wrapper to each field which automatically has a
id=div_id_<field-name>
.But, and this is my problem, if crispy renders a "hidden field", it just renders the field without wrapper.
crispy-bootstrap5/crispy_bootstrap5/templates/bootstrap5/field.html
Lines 3 to 5 in 2737939
This makes it impossible to use it as target and hide/show it dynamically.
So I have a suggestion, that may be considered impossible as it may break things, but would help crispy to be more consistent with hidden fields:
Would it be possible to also enclose the hidden field in a div that has the same id as the visible field?
this would be like:
I expanded it a bit for better readability.
What do you think about that?
The text was updated successfully, but these errors were encountered: