Skip to content

Commit

Permalink
Build dist
Browse files Browse the repository at this point in the history
  • Loading branch information
haacked committed Jul 3, 2023
1 parent 7a1aea2 commit 11c70b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions dist/aspnet-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ var MvcValidationProviders = /** @class */ (function () {
return true;
}
}
// Checkboxes do not submit a value when unchecked. To work around this, platforms such as ASP.NET render a
// hidden input with the same name as the checkbox so that a value ("false") is still submitted even when
// the checkbox is not checked. We check this special case here.
if (elementType === "checkbox") {
var checkboxHiddenInput = element.form.querySelector("input[name='".concat(element.name, "'][type='hidden']"));
if (checkboxHiddenInput instanceof HTMLInputElement && checkboxHiddenInput.value === "false") {
return true;
}
}
return false;
}
// Default behavior otherwise.
Expand Down
Loading

0 comments on commit 11c70b6

Please sign in to comment.