Problem with Checkbox Group

I thought that I would start using Checkbox Group. The problem is that I cannot get it to work. As an example, I have uploaded a document where all of the entries should have the tick showing in the checkbox with the exception of the entry coloured red and titled ‘Testing Checkbox’

Please have a look at https://pleijsiercaravans.nl/test.php and tell me where I have gone wrong.

Hey Ben,
The code looks fine to me. Is this only happening with a form generated by the generator?
what if you include the checkbox group only without a generated form like this on the page:

<div is="dmx-checkbox-group" id="chbTonen" class="checkbox-group" dmx-bind:value="ddProduct.data.tonen">
    <input class="form-check-input" type="checkbox" value="1" id="tonen" name="tonen">
</div>

Thank you for your reply. I have done as per your suggestion and placed the checkbox outside of the form with the same result :joy:

Please completely remove the form for test as now you have some duplicate IDs / Names on the page. Also please bind this on the page, to see if it returns a value:

{{ddProduct.data.tonen}}

Again I have done as proposed.

Thanks Ben, I am going to check this as the same code works perfectly on my test page.

1 Like

@Teodor, I have tried just about everything, still cannot get it to work. The only thing I can think of now is the database column type. I have tried ‘tinyint’ and ‘bit’ types with the default set at ‘0’.

May I ask what your settings are for the test page?

Yes it seems your database column type is causing the issue.
In your case, if using a single checkbox with such database column types, better use a checkbox without a group and add this:

dmx-bind:checked="ddProducts.data.tonen"

ddProducts.data.tonen == true when the value is 1
ddProducts.data.tonen == false when the value is 0

@Teodor, thank you for your answer.

Being a stubborn Nederlander, I did not give up and changed the column type to ‘varchar(1)’ and lo-and-behold, it now works within a ‘dmx-checkbox-group’.

Being a boolean value, I would have preferred to have used ‘bit(1)’. Hence I would suggest that this is a bug in App Connect.

Edit: the test page is still live for you to see.

Checkbox group expects an array and is useful when you have multiple dynamic checkboxes.
For your case - a single checkbox with a boolean value use just a regular checkbox and:

That is the way that I have done it up until now, but this topic Checkbox how to handle in update form made me think that I needed to use the checkbox group instead. My bad.