Checkboxes for non-nullable booleans fail validation when generated using @(Html.CheckBox()
or @(Html.CheckBoxFor(m => m)
#7940
Labels
Bug
C: Checkbox
FP: Completed
Sync status with associated Feedback Item
Regression
Broken functionality which was working previously
S: Wrappers (ASP.NET Core)
S: Wrappers (ASP.NET MVC)
SEV: High
Milestone
Bug report
Checkboxes for non-nullable booleans fail validation when generated using
@(Html.CheckBox()
or@(Html.CheckBoxFor(m => m)
Related to #7798
Reproduction of the problem
Model:
Implement an editable Grid and use a Boolean template for an editor where
@(Html.CheckBoxFor(m => m)
is used.Current behavior
Upon saving the checkbox validation fails.
Expected/desired behavior
Validation shall succeed.
Workarounds
public bool? Shipped { get; set; }
or@(Html.Kendo().CheckBoxFor(m => m)
ordata-val-required
attribute when the checkbox is rendered -$('input[type="checkbox"]').removeAttr('data-val-required');
(use a more specific selector if needed) orBoolean.cshtml
editor and place it in~Views\Shared\EditorTemplates\
folder where the visible<input type="checkbox" \>
is wrapped in a container element and thedata-val-required
attribute is missing.Environment
The text was updated successfully, but these errors were encountered: