adventurous-ocean-93733
12/31/2022, 2:41 AMjolly-waitress-42858
12/31/2022, 4:39 AMlimited-potato-46306
12/31/2022, 6:51 AMhundreds-cartoon-20446
12/31/2022, 6:59 AMhx-swap="outerHTML"
for your boosted links and the returned response includes the hx-history element not just its innerHTML. I should probably make that clear, or maybe detect boosted link responses another way.limited-potato-46306
12/31/2022, 7:09 AMbroad-pencil-64390
12/31/2022, 12:01 PMechoing-lion-55988
12/31/2022, 4:21 PMclever-activity-24633
12/31/2022, 4:28 PMechoing-lion-55988
12/31/2022, 4:33 PMechoing-lion-55988
12/31/2022, 4:33 PMechoing-lion-55988
12/31/2022, 4:34 PMechoing-lion-55988
12/31/2022, 4:35 PMclever-activity-24633
12/31/2022, 4:36 PMechoing-lion-55988
12/31/2022, 4:36 PMechoing-lion-55988
12/31/2022, 4:37 PMechoing-lion-55988
12/31/2022, 4:37 PMechoing-lion-55988
12/31/2022, 4:38 PMclever-activity-24633
12/31/2022, 4:38 PMechoing-lion-55988
12/31/2022, 4:39 PMclever-activity-24633
12/31/2022, 4:39 PMclever-activity-24633
12/31/2022, 4:39 PMclever-activity-24633
12/31/2022, 4:41 PMechoing-lion-55988
12/31/2022, 4:42 PMechoing-lion-55988
12/31/2022, 4:42 PMechoing-lion-55988
12/31/2022, 4:43 PMclever-activity-24633
12/31/2022, 4:44 PMclever-activity-24633
12/31/2022, 4:47 PMclever-activity-24633
12/31/2022, 4:51 PMimportant-cricket-63511
12/31/2022, 7:49 PM<form hx-post="...">
<input name="a" .../>
<input name="b" .../>
<input name="c" id="1234567" type="hidden" .../>
<NESTED FORM>
<input name="autocompleted" ... hx-post="..." hx-target="#1234567" />
</NESTED FORM>
<button type="submit">SUBMIT</button>
</form>
When the user types in the autocompleted
(which is text), I want to hit an endpoint, which will be used to replace input "c"
(id="1234567"
) with a database ID.
My main problem is that all of the form data (a
b
and c
) are sent to the autocomplete endpoint every time the user changes the autocomplete.
This is making it hard for me to build an encapsulated auto-complete server-side component that doesn't get polluted by whatever elements surround it in a form.
The other solution is for me to break out of HTMX and simply build this autocomplete in some other way (and hit a different, non-HTMX endpoint for the autocomplete results and use some JS to update form input c
when the user makes a selection)important-cricket-63511
12/31/2022, 7:57 PMhx-get
instead of hx-post
in the autocomplete -- hx-post
includes form data by default while hx-get
does not
(I was using hx-post
because the autocomplete can potentially create new database IDs if the user ends a new string value that has not yet been seen before -- but frankly this sort of idempotent is probably find to put in a get
)