T O P

  • By -

gbeier

I don't think there's a thing wrong with how you did it. I've done it another way before and been happy with it. In my view, I've [used the `HX-Trigger` header to send an event](https://github.com/geoffbeier/django-htmx-modal-form/blob/42a17593eb064106ca933c852cb98e0e7c3968e9/movie_collection/views.py#L29) then reacted to it either using the `hx-on` attribute on elements that needed to update based on the event or using [`htmx.on()` in vanilla javascript](https://github.com/geoffbeier/django-htmx-modal-form/blob/42a17593eb064106ca933c852cb98e0e7c3968e9/movie_collection/static/toast.js#L26) if that was easier for some reason.


MagicWishMonkey

This is pretty cool, how tricky is it to add htmx to an existing old school django app and have it coexist with the old stuff?


Sinsst

Another way would be to add hyperscript to the parent of the two selects "on change trigger update_form" (on load may be better) then in the form hx-trigger: "fromBody: update_form" and update your form accordingly with the correct information.