gray-quill-46940
03/23/2023, 1:32 PMhigh-holiday-5113
03/23/2023, 2:49 PMquerySelectorAll("hx-foo, hx-bar")
. Why isn't it a solution? Maybe there's some king of RFC I can read?ripe-action-67367
03/23/2023, 3:39 PMmysterious-toddler-20573
03/23/2023, 3:40 PMeager-plumber-49649
03/23/2023, 4:51 PMeager-plumber-49649
03/23/2023, 4:55 PMrapid-lunch-78326
03/23/2023, 5:53 PM<form id="basket-wrapper"
method="post"
hx-target="#basket-wrapper"
hx-post=""
hx-ext="morphdom-swap"
hx-swap="morphdom">
<div hx-trigger="change from:find input" hx-post="">
<input type="text" name="billing_first_name" id="billing_first_name_id" value="">
</div>
...another inputs
<button hx-swap="morphdom show:.field-error:bottom"
type="submit"
name="next"
value="1">
Proceed to summary
</button>
</form>
So, when you blur from the input it is send to server for validation and when you click on button submit is triggered and form is also send to server. When you click on button there is also button data {next: 1, billing_first_name: 'something'}
I am trying to achieve that if you click on button, you are scrolled to first error, but not when you jus change input.
Is it possible somehow "override" swap behaviour based on trigger element ?
When I change button it in this way
<button hx-swap="morphdom show:window:top"
hx-trigger="click"
hx-target="#basket-wrapper"
hx-post=""
type="button"
name="next"
value="1">
Proceed to summary
</button>
scroll is working but value next=1 is not presented in request.happy-knife-63802
03/24/2023, 8:17 AMhappy-knife-63802
03/24/2023, 8:18 AMsome-airline-73512
03/24/2023, 12:07 PMbillions-microphone-84331
03/24/2023, 12:15 PMbillions-microphone-84331
03/24/2023, 12:16 PMorange-umbrella-16693
03/24/2023, 12:39 PMinnerHTML
? If so, is there currently a way to handle that circumstance with events?
I couldn't find anything in code related to this.mysterious-car-3675
03/24/2023, 1:11 PMorange-umbrella-16693
03/24/2023, 1:16 PMorange-umbrella-16693
03/24/2023, 1:18 PMhx-get="/something"
gets removed from the DOM, does the event listener and related data gets "GC’d" (as in neatly deinitialized and event listener removed) by the library or does nothing really happen?orange-umbrella-16693
03/24/2023, 1:18 PMhx-ext="ws"
for exampleorange-umbrella-16693
03/24/2023, 1:19 PMmysterious-toddler-20573
03/24/2023, 1:26 PMhundreds-cartoon-20446
03/24/2023, 2:41 PMdocument.querySelector()
) that you haven't subsequently nulled, then the element and it's event listeners will hang around using memory even after it is removed from the DOM. So generally it's a good idea to cleanup after yourself, IF you do attach any custom javascript behaviour to a dom element that is likely to be swapped out. Htmx doesn't do anything else by default other than handle it's own event listeners and internal state, afaik.mysterious-toddler-20573
03/24/2023, 3:15 PMgray-morning-3453
03/24/2023, 4:35 PMhtmx.on("messages", (event) => {
console.log("message received");
event.detail.value.forEach(createToast);
})
And this script should create a toast and show it on the page. This setup is working fine on another project. I have verified that toasts.js is being loaded, and that reponse headers are reaching the client, but htmx.on() is not firing for some reason. Any ideas what I should check?ripe-action-67367
03/24/2023, 4:44 PMhtmx.logAll()
in the console to enable verbose events logging and check if there is anything out of orderfresh-midnight-60146
03/24/2023, 5:08 PMgray-morning-3453
03/24/2023, 5:26 PMHX-Trigger: {"accounts:changed": true, "messages": [{"message": "Company user updated", "tags": "success"}]}
And if I attach an htmx.on to accounts:changed it works! So I am not sure why the message handler is not being fired.gray-morning-3453
03/24/2023, 5:27 PMhtmx.on("accounts:changed", (event) =>{console.log("I caught it!")})
limited-teacher-83117
03/24/2023, 5:57 PMorange-umbrella-16693
03/24/2023, 5:57 PM