When clicking on the checkbox, form is submitted using jQuery, but checkbox always return null.
I have the following Razor code:
@using (Html.BeginForm("Index", "HumanResource", new { type = ViewBag.CurrentType }, FormMethod.Post, new { id = "form1" }))
{
<label class="custom-control custom-checkbox" for="Filter">
@Html.CheckBox("Filter", new { @class = "custom-control-input" })
<span class="custom-control-indicator"></span>
Choose
</label>
}
// Scripts
<script>
$('#form1 :checkbox').change(function() {
$("#form1").submit();
});
</script>
Controller
public async Task<ActionResult> Index(FormCollection fc,int? Filter)
{
// leftFilter is always null
}