Skip to main content

ValidationObject

ValidationObject = object

Properties​

caseSensitive?​

optional caseSensitive?: boolean

Whether to check case sensitivity (i flag)


global?​

optional global?: boolean

Whether to check global strings (g flag)


message?​

optional message?: string

Error message shown to user if validation fails

Example: "Invalid email format"


multiline?​

optional multiline?: boolean

Whether to check Multiline strings (m flag)


regExp?​

optional regExp?: string

Should be pure string (not RegExp string)

Example:

// regex for email
regExp: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',

validator?​

optional validator?: (value, record, adminForth) => { isValid: boolean; message?: string; } | Promise<{ isValid: boolean; message?: string; }> | boolean

Custom validator function.

Example:

validator: async (value) => {
// custom validation logic
return { isValid: true, message: 'Validation passed' }; // or { isValid: false, message: 'Validation failed' }
}

Parameters​

ParameterType
valueany
recordany
adminForthIAdminForth

Returns​

{ isValid: boolean; message?: string; } | Promise<{ isValid: boolean; message?: string; }> | boolean