by BiteCode_dev · 3y ago · 0 comments
But, let's talk about the confirm. For a simple one, you would use hx-confirm and be done.
However, for a more complex confirm, you would make a delete request that would answer HTML.
The HTML would be showing the confirmation with the data calculated from the server (124 rides this year).
The response doesn't have to be a button, the server can answer a modal or a new subpage, which would contain a hx-delete with a "userconfirm=1" in qs and a cancel button to go back.
You don't have to limit yourself to replace the current element with the response, and the response is not limited to basic workflow.
Also HTMX is mostly about using hypermedia to communicate and favor the server to manage the state, but there is nothing saying you can't use JS.
You can even be naughty and have new HTML responses inject new JS in the page.
No comments yet.