--- title: The trickiness of HTML checkbox date: 2025-10-22 16:29:02.692510 UTC --- I'm using [Lustre](https://hexdocs.pm/lustre/) framework to rebuild the Admin area of [this blog](https://github.com/hongquan/QuanWeb). When implementing the form for editing blog post, I'm surprised how tricky to handle the checkbox, which may look simple at first. In CRUD applications, people often use the checkbox to represent a boolean field. The "checked" status is for `True` and unchecked is for `False`. Take this form as example, when I want to publish a post, I tick the "Published" checkbox and save. If I want to unpublish, I untick and save.  Most of people don't see any issue with this usage. When I make frontend apps with VueJS, with an edit form like this, I often bind each `` element with a reactive variable, via `v-model`: ```vue
``` Vue, and maybe other frameworks of the same kind (React, Svelte etc.), supports this use case extremely well. When I make frontend apps with [Lustre](https://hexdocs.pm/lustre/), a framework with quite different architecture from the above names, I choose the approach which looks more like in backend side. I just collect the data that a HTML `