htmx
htmx copied to clipboard
hx-boost wrongly creates a history record
According to the docs the following two forms should have the same functionality but it doesn't.
First of all, the documentation for hx-boost says that it won't update the history when it's used in forms but that's not the case.
The url will not be pushed, however, and no history entry will be created. (You can use the [hx-push-url] attribute if you want the url to be pushed.)
- If you visit
localhost
which contains the following form and you press the submit button the url will change tolocalhost/register
.
<form hx-boost="true" action="/register" method="POST">
<input name="email" id="email">
<button type="submit">Continue</button>
</form>
- If i change the first form and add hx-push-url="false" it will not update the history
<form hx-boost="true" hx-push-url="false" action="/register" method="POST">
<input name="email" id="email">
<button type="submit">Continue</button>
</form>
Perhaps this is bad wording just to say the url will replace the current one instead of being pushed. I don't have enough knowledge to know if that's what they meant, though. In any case, the docs should probably be updated.