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

CustomMessagesInterface

The CustomMessagesInterface defines the structure of custom error messages for various input types in the NFSFU234FormValidation Library. These custom messages allow developers to specify user-friendly error messages for different types of input fields during form validation.

ParameterTypeDefaultDescription
textstringundefinedCustom error message for text inputs.
checkboxstringundefinedCustom error message for checkbox inputs.
colorstringundefinedCustom error message for color inputs.
datetimestringundefinedCustom error message for datetime inputs.
datestringundefinedCustom error message for date inputs.
datetime-localstringundefinedCustom error message for datetime-local inputs.
emailobjectundefinedCustom error messages for email inputs, including specific messages for empty and invalid cases.
email.emptystringundefinedCustom error message when the email input is empty.
email.invalidstringundefinedCustom error message when the email input is invalid.
filestringundefinedCustom error message for file inputs.
hiddenstringundefinedCustom error message for hidden inputs.
imagestringundefinedCustom error message for image inputs.
monthstringundefinedCustom error message for month inputs.
numberstringundefinedCustom error message for number inputs.
passwordstringundefinedCustom error message for password inputs.
radiostringundefinedCustom error message for radio inputs.
rangestringundefinedCustom error message for range inputs.
resetstringundefinedCustom error message for reset inputs.
searchstringundefinedCustom error message for search inputs.
submitstringundefinedCustom error message for submit inputs.
telstringundefinedCustom error message for tel inputs.
textareastringundefinedCustom error message for textarea inputs.
timestringundefinedCustom error message for time inputs.
urlobjectundefinedCustom error messages for URL inputs, including specific messages for empty and invalid cases.
url.emptystringundefinedCustom error message when the URL input is empty.
url.invalidstringundefinedCustom error message when the URL input is invalid.
weekstringundefinedCustom error message for week inputs.
zipcodeobjectundefinedCustom error messages for zipcode inputs, including specific messages for empty and invalid cases.
zipcode.emptystringundefinedCustom error message when the zipcode input is empty.
zipcode.invalidstringundefinedCustom error message when the zipcode input is invalid.

Usage

Example: Setting Custom Error Messages using the Validate API function

const customMessages = { email: { empty: "Please enter your email address.", invalid: "The email address you entered is not valid." }, password: "Your password must be at least 8 characters long." }; nfsfu234FormValidation.validate(myForm, { customErrorMessages: customMessages }, (response) => { if (!response.isValid) { console.log(response.errorMessages); } });

See also

Last updated on