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’
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:
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:
@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
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.
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.