white-motorcycle-95262
01/24/2022, 12:58 AMHX-Retarget to the response to also change the target then, right?
Seems weird, but it's for a create account/login form and then either 1) payment form or 2) profile responsemysterious-toddler-20573
01/24/2022, 2:43 AMwhite-motorcycle-95262
01/24/2022, 2:55 AMHX-Retarget if it came from a 3xx? My understanding is:
1) A form with hx-post and hx-target="#login-form" is submitted by HTMX
2) My login view reads it, verifies the form, logs the user in
3) I create a HttpResponseRedirect, which is just a 302 and a Location header. I add in the HX-Retarget header: response['HX-Retarget'] = "#content" this is returned
4) HTMX sees this response and then makes a new (GET) call to the Location header (Profile view)
5) In my Profile View, everything goes as expected, but if I examine the request, it doesn't have HX-Retarget in it, it still has HX-Target as #login-form.
6) The entire profile page gets swapped into the #login-form div.
Trying to figure out where the HX-Retarget header gets removed.mysterious-toddler-20573
01/24/2022, 3:04 AMmysterious-toddler-20573
01/24/2022, 3:04 AMdry-window-71739
01/24/2022, 3:10 AMmysterious-toddler-20573
01/24/2022, 3:59 AMmysterious-toddler-20573
01/24/2022, 4:01 AMdry-window-71739
01/24/2022, 4:12 AMadorable-portugal-365
01/24/2022, 9:43 AMstocky-dentist-80693
01/24/2022, 10:43 AMhx-trigger attribute of the form - https://htmx.org/attributes/hx-trigger/adorable-portugal-365
01/24/2022, 11:02 AMstocky-dentist-80693
01/24/2022, 11:59 AMbland-coat-6833
01/24/2022, 12:09 PMhx-post on the <input> and have that commit things to the server.adorable-portugal-365
01/24/2022, 1:44 PMadorable-portugal-365
01/24/2022, 1:48 PMstocky-dentist-80693
01/24/2022, 2:01 PMbland-coat-6833
01/24/2022, 2:04 PMhx-post but also an hx-trigger="new-contact-loaded" (or whatever). Then have the click handler on your contact list that fires that event.
How are you letting them reset the form btw? Asking the server for the existing version?mysterious-toddler-20573
01/24/2022, 2:14 PMhx-include and then have a hidden input dirty flag that was triggered when an input was modified in the form. Since navigation can cause an update, I would use hx-post with it.mysterious-toddler-20573
01/24/2022, 2:15 PMmysterious-toddler-20573
01/24/2022, 2:15 PMadorable-portugal-365
01/24/2022, 2:22 PMmysterious-toddler-20573
01/24/2022, 2:23 PMmysterious-toddler-20573
01/24/2022, 2:24 PMmysterious-toddler-20573
01/24/2022, 2:25 PMmysterious-toddler-20573
01/24/2022, 2:28 PMadorable-portugal-365
01/24/2022, 2:41 PMmysterious-toddler-20573
01/24/2022, 3:04 PMmysterious-toddler-20573
01/24/2022, 5:34 PMbland-coat-6833
01/24/2022, 6:27 PM