hx-push-url
attributes so that the URL updates? Depends on how your backend works (you need to differentiate between an ajax request and a full page request) but that makes for bookmarkable URLs and back button support.
The only JS in the application is this bit, for displaying an error in the case that the server is down:
htmx.on("sendError.htmx", function(evt) {
document.getElementById("globalerrorpane").innerHTML=
"sendError.htmx: readyState:" +
evt.detail.xhr.readyState + " status:" + evt.detail.xhr.status;
});
Could you guys come up with a feature in htmx so that I can drop this last line of JS, and I call my application a 'NoJS' web-application? ;-)
Could I check my understanding of Htmx parameters?
Reading the docs I note that
...an element that causes a request will include its value if it has one...
So therefore I had expected this...
<button hx-post="serverAction"
hx-target="closest .insert-me"
hx-swap="afterbegin"
value="abc"
class="btn btn-primary btn-sm">
...to send the value "abc" to the server in Form data, but it doesn't?
What I do see is a header hx-active-element-value
containing the "abc" value.
So I'm not stuck, since I can use the header, but I am a little puzzled. What do you think?