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

validateAllRadio

The validateAllRadio function validates all radio button groups within a specified form. It returns an array of error messages (a nested ErrorMessageInterface) if any group is invalid, or a single instance of ErrorMessageInterface if all fields are valid.

Works in: HTML5, React JS

ParameterTypeDefaultDescription
formHTMLFormElement | HTMLDivElement | stringundefinedThe form element or its ID containing radio button groups.
customErrorMessageobject{}Custom error message to return if validation fails.

Usage

Example: Validate All Radio Button Groups in a Form

const formElement = document.getElementById('myForm'); const result = nfsfu234FormValidation.validateAllRadio(formElement, { message: 'Please select an option for all required questions.' }); console.log(result);

See also

Last updated on