Read and Write Boolean Values to Checkboxes

Wow… I’ve just spent forever working out how to do this and reading lots of posts that seemed very confusing for quite a while…

So here, while it is fresh in my head, is the bullet point summary of how to read and write boolean values to Checkboxes.

Background Information

In following why it is done this way, there are a couple of things to be aware of:

Still with me?

While this all sounds complex, what you need to do is actually quite simple:

Writing Information To the Database

(If you don’t have a checkbox group or custom switch container for the checkbox, perform the actions listed to be on the Bootstrap 4 Container directly on the <checkbox> element instead.

  1. On the Bootstrap 4 Container set Checkbox Static Value = 1
  2. In your Server Action, set the $_POST variable to be of type Boolean
  3. In the Server Action database update action, set your boolean field to be updated to the value {{$_POST.your_fieldname.default(0)}}

Reading Information From the Database

  1. On the Bootstrap 4 Container, set the Dynamic Attribute “Checked” to the field value being returned by your database via the Server Connect element.

For more Information
See:
How to bind the value to checkbox

Community Page
Last updated: