breezy-minister-64652
10/18/2022, 10:26 AMtall-dinner-62086
10/18/2022, 10:29 AMoob-swap
to return a message from the server, no need to mess around with eventsbreezy-minister-64652
10/18/2022, 10:37 AMtall-dinner-62086
10/18/2022, 10:39 AMbreezy-minister-64652
10/18/2022, 10:40 AMbreezy-minister-64652
10/18/2022, 10:41 AMbreezy-minister-64652
10/18/2022, 12:34 PMtall-dinner-62086
10/18/2022, 12:43 PMtall-dinner-62086
10/18/2022, 12:43 PMbreezy-minister-64652
10/18/2022, 12:52 PMtall-dinner-62086
10/18/2022, 12:54 PMbreezy-minister-64652
10/18/2022, 12:54 PMbreezy-minister-64652
10/18/2022, 12:55 PMtall-dinner-62086
10/18/2022, 12:55 PMhx-swap-oob
and swaps it in place. Doesn't matter if it's an error message or a success message or a copy of the illustrated bible.gorgeous-airport-54386
10/18/2022, 1:00 PMbreezy-minister-64652
10/18/2022, 1:02 PMtall-dinner-62086
10/18/2022, 1:04 PMhx-swap-oob="true" id="myStatusDiv"
. Then you make sure the server includes the message in a div with that id and and attribute, such as html
<div id="myStatusDiv" hx-swap-oob="true" class="success">
We did the thing!
</div>
on success or html
<div id="myStatusDiv" hx-swap-oob="true" class="error">
We couldn't do the thing!
</div>
breezy-minister-64652
10/18/2022, 1:05 PMbreezy-minister-64652
10/18/2022, 1:05 PMtall-dinner-62086
10/18/2022, 1:05 PMbreezy-minister-64652
10/18/2022, 1:06 PMbreezy-minister-64652
10/18/2022, 1:43 PMbitter-monkey-50309
10/18/2022, 1:44 PMtall-dinner-62086
10/18/2022, 1:44 PMbitter-monkey-50309
10/18/2022, 1:45 PMbreezy-minister-64652
10/18/2022, 1:48 PMbreezy-minister-64652
10/18/2022, 1:49 PMbreezy-minister-64652
10/18/2022, 1:49 PMtall-dinner-62086
10/18/2022, 1:56 PMhx-swap-oob="beforeend"
. Sure enough it didn't handle connection issues very well, but I haven't had to worry too much about those yet. Related to this, the template tag idea described here sounds like it could facilitate this type of error message