How to handle switch toggle in update form

Hi Everyone,

I am struggling with binding the checked state of a switch toggle in update form. I have the data saved in database as true/false, but every time the state is coming as checked even when the value is false.

This is the field that I have:

<div class="custom-control custom-switch custom-switch-sm">
	<input type="checkbox" class="custom-control-input" id="inp_Notify" name="Notify"
		dmx-bind:checked="sc_listApps.data[varRowIndex.value].Notify" value="1">
	<label class="custom-control-label" for="inp_Notify">Notify</label>
</div>

I have checked numerous posts regarding this but I am not able to get it working Checkbox how to handle in update form

Anyone can explain where I am going wrong?

Try this:

dmx-bind:checked="sc_listApps.data.qrylistApps[0].Notify == 1"

where qrylistApps is the database query with the detail data

That made it thank you.

I don’t know how come I missed this one

1 Like