Skip to Content
NFSFU234FormValidation v3 is here — file upload validation, config-driven rules, and more.
v3 (current)validateCheckbox

validateCheckbox

Validates a single checkbox field. Returns: boolean \| ErrorMessageInterface

ParameterTypeRequiredDefaultDescription
checkboxInputFieldHTMLInputElementrequired-The checkbox to validate.
optionsanyoptional-Overrides for the field’s validation rule (e.g. required).
Usage
Example: Validate a Checkbox Input
// Using with a checkbox input element const checkboxElement = document.querySelector('input[type="checkbox"]'); const result = nfsfu234FormValidation.validateCheckbox(checkboxElement, { message: 'You must agree to the terms and conditions.' }); console.log(result);
Last updated on