Could you just not bind ‘checked’ to the checkbox input, like below? If your database field named ‘red’ for instance is not empty the checkbox is checked:
<input type="checkbox" value="red" dmx-bind:checked="red != ''">
I have zero idea if that is a correct Wappler workflow but it seems to work for me.
For instance if you’re using ‘dmx-data-detail’ to retrieve the details based on passing an ‘identifier’ from a link it would look something like below. IF the database field associated with the checkbox for ‘oranges’ as the value is NOT empty then it must have a value of ‘oranges’ as previously selected and as it’s NOT empty then the checkbox is ‘currently’ selected.
<a href="#" dmx-on:click="fruit_details.select(productCode)">{{ name }}</a>
<dmx-data-detail id="fruit_details" dmx-bind:data="conn_fruits.data.fruits" key="productCode">
<h6>{{ data.productCode }}</h6>
<h3>{{ data.name }}</h3>
<input type="checkbox" value="oranges" dmx-bind:checked="data.oranges != ''">
</dmx-data-detail>
This workflow assumes that you’re requesting the ‘details’ to be retrieved and shown on the same page as where your links to the details are listed.