cuddly-keyboard-70746
11/18/2022, 5:50 AMThis is part of a broader conspiracy to make web development so annoying and difficult that we do not rise up against the elites
Damnnnn, niceclean-arm-73414
11/18/2022, 8:01 AM_="on htmx:afterRequest set #someid to ''"
=> A target expression must be writable. The expression type 'idRef' is not.
_="on htmx:afterRequest set #someid@value to ''"
=> no error , no change visually. if i inspect the field the value is set to '' though ..
I'm clearly missing something, dunno what yet.astonishing-barista-36240
11/18/2022, 8:19 AM<input id="someid" value="foobar" _="on click set #someid@value to 'woot'">
works for meastonishing-barista-36240
11/18/2022, 8:19 AMhtmx:afterRequest
. Is #someid
part of the dom that is swapped in or out?astonishing-barista-36240
11/18/2022, 8:20 AM#someid
is created as part of the htmx request swapping you should probably use a different event like htmx:afterSwap
or htmx:afterSettle
clean-arm-73414
11/18/2022, 8:33 AMdazzling-dusk-82436
11/18/2022, 8:40 AMdazzling-dusk-82436
11/18/2022, 8:41 AMboundless-vase-80440
11/18/2022, 11:27 AMdelightful-pager-22557
11/18/2022, 11:47 AMsome-airline-73512
11/18/2022, 11:47 AMbroad-pencil-64390
11/18/2022, 11:56 AMname="test" hx-get="" hx-push-url="true"
(meaning it will make a GET request with whatever the current url is). If I change item twice it means I get the parameter twice like test=1&test=2
. I need it to instead replace the value for test
.
I can hack around this by instead using HX-Push-Url
response header and dedupe test
on the server side, but I was thinking maybe there's a way to make htmx replace rather than add? (I know it's the standard that enables having multiple of the same key to handle multi-select etc, but still.)some-airline-73512
11/18/2022, 12:32 PMapplescript
<script src="https://demo.htmx.org"></script>
<div style="background-color:red;width:500px;height:300px;padding:12px;font-size:64px"
hx-trigger="doit"
hx-get="/example"
_="on mouseenter
wait for mouseout or 1s
if the result is not a MouseEvent
trigger doit">
<p>
Move mouse into me and wait a sec
</p>
</div>
<template url="/example">
Request Made...
</template>
mysterious-toddler-20573
11/18/2022, 2:14 PMmouseleave
mysterious-toddler-20573
11/18/2022, 2:14 PMwhite-london-59674
11/18/2022, 2:31 PMbroad-pencil-64390
11/18/2022, 2:49 PMhx-get=""
that wasn't a good way it seems 😅 instead I keep form state via hx-include
mysterious-toddler-20573
11/18/2022, 2:55 PMmysterious-toddler-20573
11/18/2022, 2:55 PMdazzling-dusk-82436
11/18/2022, 2:56 PMdazzling-dusk-82436
11/18/2022, 2:56 PMdazzling-dusk-82436
11/18/2022, 2:56 PMminiature-lizard-24702
11/18/2022, 3:07 PMminiature-lizard-24702
11/18/2022, 3:08 PMminiature-lizard-24702
11/18/2022, 3:08 PMhappy-pillow-29003
11/18/2022, 3:55 PMhx-trigger="load"
to only trigger it on initial load, and then add a htmx.trigger(elem, 'change')
but this causes an infinite recursion (I guess this triggers an actual js change event?), but I just want to trigger the ajax request.some-airline-73512
11/18/2022, 5:22 PMstraight-appointment-14669
11/18/2022, 5:24 PMthankful-apartment-66679
11/18/2022, 5:24 PMmysterious-toddler-20573
11/18/2022, 5:25 PM