Explains how to force required on checkbox.
<input type="checkbox" id="TermsOfUseFake">
<label for="TermsOfUseFake"><a href='@navLinks.GetSitePageLink(languageGroupId: "TermsOfUse")' target="_blank">@Localizer["Loyalty.RegisterForm.TermsOfUse"]</a></label><br>
<input style="width:0px;border:0px!important;padding:0px;" type="text" asp-for="TermsOfUse" />
<span asp-validation-for="TermsOfUse" class="text-danger"></span>
$(document).on('change', '#TermsOfUseFake', function () {
debugger;
if ($('#TermsOfUseFake:checked')[0]) {
$('#TermsOfUse').val("true");
}
else {
$('#TermsOfUse').val("");
}
$("form#registerForm").validate().element("#TermsOfUse");
});
No comments:
Post a Comment