Dymanically checking an array of checkboxes

Hi everyone,

I am recording the output of checkboxes values in a single column in a database (ex: 2,4,6,9). I’m using a checkbox group to this effect, with the checkbox name ending with .
For editing purposes, I’d like those checkboxes whose ID matches one of the values recorded in the array to be dynamically checked. I haven’t found a tutorial for the same, would anyone have any guidance?

Many thanks.

Hi,
I think there is a tutorial for this in community.

Since you have the values comma seprated in single column, you need to split and find the value to check a checkbox.
dmx-bind:checked="dbfield.split(',').contains(4)
4 here is the value of checkbox. So it will change on each one.

1 Like

That worked very well, thanks @sid.
I’ll look some more for that tutorial.