Closed totaltrash closed 3 months ago
@totaltrash I think that's expected. You can't really "uncheck" a checkbox. In a form, it needs to have a corresponding hidden input.
Here's a note from MDN docs:
Note: If a checkbox is unchecked when its form is submitted, neither the name nor the value is submitted to the server. There is no HTML-only method of representing a checkbox's unchecked state (e.g. value=unchecked). If you wanted to submit a default value for the checkbox when it is unchecked, you could include JavaScript to create a within the form with a value indicating an unchecked state.
Hi @germsvel thanks for your reply. Yes totally understand that, in my case i have a liveview that expects nothing to be posted when all items are unchecked, which works great "in real life" but errors in PhoenixTest. I have a workaround so I'll close this issue and the PR
If you have a checkbox without a hidden:
Results in: