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

validateAllInput

The validateAllInput function validates all input fields within a specified form and returns an array of error messages (a nested ErrorMessageInterface) if 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.
optionsobject{}Additional options for validation.

Usage

Example: Validate All Input Fields in a Form

const formElement = document.getElementById('myForm'); nfsfu234FormValidation.validateAllInput(formElement, { customErrorMessages: { email: 'Please enter a valid email address.', url: 'Please enter a valid URL.', date: 'Please enter a valid date.', } }).then(response => { console.log(response); });

See also

Last updated on