bigskysoftware / bigskysoftware/htmx

when using hx-boost on my form, the value of checkboxes get lost when hitting the back button

Open
#2,462 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

I have a simple form I am using to test htmx. It has a few checkboxes and POST's the data to a server.

```




a1



a2



a3



```
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:
` `

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.