I have a checkbox validation before i submit the page. But it works in reverse. It's displaying error message when i check the box instead of opposite. I don't know where im doing wrong.
My ViewModel
[Display(Name = "Terms and Conditions")]
[Range(typeof(bool), "true", "true", ErrorMessage = "Please accept Terms & Conditions")]
public bool IsTermsAccepted { get; set; }
My View
<div class="row col-lg-offset-2 top-buffer">
@Html.CheckBoxFor(model => model.IsTermsAccepted)
@Html.LabelFor(model => model.IsTermsAccepted)
<br>@Html.ValidationMessageFor(model => model.IsTermsAccepted)
</div>
Thank you for your time!
Aucun commentaire:
Enregistrer un commentaire