hundreds-camera-24900
10/13/2022, 2:16 PMfierce-alarm-63599
10/13/2022, 2:55 PMformdata
event to inject its input values when you instantiate FormData with the form, htmx does seem to use FormData (explicitly stated when doing the multipart format) so I can't really tell why it's not being included
https://shoelace.style/getting-started/form-controlsfierce-alarm-63599
10/13/2022, 2:57 PMmysterious-toddler-20573
10/13/2022, 3:05 PMgreen-ram-18435
10/13/2022, 3:23 PMmysterious-toddler-20573
10/13/2022, 4:13 PMmysterious-toddler-20573
10/13/2022, 4:14 PMmysterious-toddler-20573
10/13/2022, 4:14 PMmysterious-toddler-20573
10/13/2022, 4:15 PMhx-preserve="true"
2 - catching the htmx:removingHeadElement
event and calling preventDefault()
3 - annotating the new head
element with hx-swap-oob="beforeend"
mysterious-toddler-20573
10/13/2022, 4:16 PMwhite-motorcycle-95262
10/13/2022, 4:37 PMhx-select
for my error catching. Is it proper to set event.detail.select
as below..or more like I do event.detail.target
? Or is it not possible to do what I want? Seems like neither way works, but I'm not sure if it's due to something else or what
document.addEventListener("htmx:beforeSwap", (event) => {
switch (event.detail.xhr.status) {
case 403:
case 404:
case 500:
event.detail.shouldSwap = true;
event.detail.isError = false;
event.detail.target = htmx.find("#main");
event.detail.select = "#main";
}
});
EDIT: Looks like maybe it's not a thing, after inspecting event.detail
. I think I'm able to get around it with some template changes, but just thought I'd post here to see.melodic-france-58143
10/13/2022, 4:59 PM/article/<id>/
The default would be a full page view of it. But you could add query parameters to say, ask for the "in a list" or "compact card" view of the same data.
I was trying to minimize the amount of nesting of routes.
Does that sound reasonable?melodic-france-58143
10/13/2022, 5:01 PMmelodic-france-58143
10/13/2022, 5:02 PMmelodic-france-58143
10/13/2022, 5:03 PMmysterious-toddler-20573
10/13/2022, 7:26 PMmysterious-toddler-20573
10/13/2022, 7:27 PMechoing-dress-67727
10/13/2022, 7:44 PMHX-Redirect
and returning a response code of 286
, but it seems that doesn't work. I looked at the code and I think it's because this block: https://github.com/bigskysoftware/htmx/blob/master/src/htmx.js#L3010 returns before it gets to the line checking for 286
white-motorcycle-95262
10/13/2022, 7:52 PMHX-Location
headers is working on my Django development server, but not in production (nginx). The Response headers still contain the HX-Location info, but it's not issuing a request (or throwing an HTMX error). How can I further debug this?mysterious-toddler-20573
10/13/2022, 7:56 PMmysterious-toddler-20573
10/13/2022, 7:56 PMmysterious-toddler-20573
10/13/2022, 7:56 PMmysterious-toddler-20573
10/13/2022, 7:58 PMHX-Trigger
to trigger the redirect via some javascript you write, and add a timeout of 0 to it, so the response hander can get through the poll cancellation and then do the redirect.mysterious-toddler-20573
10/13/2022, 7:58 PMmysterious-toddler-20573
10/13/2022, 7:58 PMechoing-dress-67727
10/13/2022, 8:01 PMdelay
to do polling. When the element loads, it waits however long, then makes a new request. Then if the response re-loads the element, it'll do it again. That the idea there?echoing-dress-67727
10/13/2022, 8:04 PMcancelPolling
block up higher, above the other header checks? Or is there a reason for it to be after those?echoing-dress-67727
10/13/2022, 8:18 PMwhite-motorcycle-95262
10/13/2022, 8:19 PMnpm list
on both servers shows htmx.org@1.8.0
, my production server is sending 1.7.0. 🤷♂️