fix(validator): use a checked attribute for required validation in checkboxes (#205)
This commit is contained in:
parent
21cd3f1775
commit
2f2c28b13f
1 changed files with 2 additions and 1 deletions
|
@ -40,7 +40,8 @@ const { hook = 'all', displayErrorMessages = false } = Astro.props;
|
|||
const limit = element.getAttribute(attribute);
|
||||
return `${attribute}:${limit}`;
|
||||
});
|
||||
const value = element.value;
|
||||
const value =
|
||||
element.type === 'checkbox' ? (element.checked ? 'checked' : '') : element.value;
|
||||
const errors = validate(value, validators);
|
||||
|
||||
// set element hasErrors
|
||||
|
|
Loading…
Reference in a new issue