Open greenersharp opened 7 months ago
Have you tried hx-push-url="false"
? Just a thought, not sure, honestly just spitballing
Thanks, this works, the form is remembering the checkbox states now.
I don't know why hx-push-url="false"
is not default for boosted forms?
I have a simple form I am using to test htmx. It has a few checkboxes and POST's the data to a server.
Let's assume I check all 3 checkboxes. I then submit the form.
hx-boost does it's thing and it swaps in the response from the /results endpoint (which simply returns "hello world"). so far so good.
Now, when I hit the back button, to go back to the form with the checkboxes, all the checkboxes return to their original, unchecked states.
However, the checkbox states do get saved when I submit the FORM without boosting:
<form hx-boost="false" action="/results" method="post">
When not using boosting, and submitting the form as normal, the browser saves the checkbox state when I hit the back button. All checkboxes I check before submitting the form, are still checked when I hit the back button.
Why is boosting on my form changing the browsers default behavior of saving the checkbox state ? And how can I get my boosted form submission to save the checkbox states when hitting the back button ?
Thank you