Bootstrap switches return "on/off" instead of "true/false"

From the HTML specifications, the default value for a checkbox is "on" because you have not included a value attribute

default/on

On getting, if the element has a value attribute, it must return that attribute's value; otherwise, it must return the string "on". On setting, it must set the element's value attribute to the new value.

Change you html to

<div class="bootstrap-switch-square">
  <input type="checkbox" data-toggle="switch" name="Resend" id="Resend" value="true" />
</div>

so that if its checked, a value of true will be sent in the form data and correctly bound to your boolean property (if unchecked, no value will be sent and the property will be its default (false) value


I am just adding my findings to add more values in this question. I have the following code on a razor view

<label class="switch">
    @{ var isAssigned = Model?.Any(x => x.Id == group.Id) ?? false; }
    <input type="checkbox" data-toggle="toggle"
           name="AssignedGroups[@index].Assigned"  value="@isAssigned" 
           @(isAssigned ? "checked" : "") />
    <span class="slider"></span>
</label>

When the form is posted ModelState was in vaild on it show the following errors

The value 'value' is not valid for Assigned.

and when i moved the value attribute after the checked attribute it started working

<input type="checkbox" data-toggle="toggle" name="AssignedGroups[@index].Assigned"  
@(isAssigned ? "checked" : "") value="@isAssigned" />

From this, I guess the order of the value attribute is also important. Please corrent me if i am worng.