Skip to Content
ContentAPIVariablesVariable: commonValidations

Hero Hook Form API v2.5.1


Hero Hook Form API / commonValidations

Variable: commonValidations

const commonValidations: object

Defined in: utils/validation.ts:196 

Common validation patterns for forms

Type Declaration

confirmPassword()

confirmPassword: (passwordField, confirmField) => ZodObject<{[key: string]: ZodString; }, $strip>

Parameters

passwordField

string

confirmField

string

Returns

ZodObject<{[key: string]: ZodString; }, $strip>

date()

date: (fieldName) => ZodDate

Parameters

fieldName

string

Returns

ZodDate

email

email: ZodEmail

file()

file: (maxSizeInMB?, allowedTypes?) => ZodCustom<File, File>

Parameters

maxSizeInMB?

number

allowedTypes?

string[]

Returns

ZodCustom<File, File>

futureDate()

futureDate: (fieldName) => ZodDate

Parameters

fieldName

string

Returns

ZodDate

maxLength()

maxLength: (max, fieldName) => ZodString

Parameters

max

number

fieldName

string

Returns

ZodString

minLength()

minLength: (min, fieldName) => ZodString

Parameters

min

number

fieldName

string

Returns

ZodString

numberRange()

numberRange: (min, max, fieldName) => ZodNumber

Parameters

min

number

max

number

fieldName

string

Returns

ZodNumber

password()

password: (minLength?) => ZodString

Parameters

minLength?

number

Returns

ZodString

pastDate()

pastDate: (fieldName) => ZodDate

Parameters

fieldName

string

Returns

ZodDate

phone

phone: ZodString

required()

required: (fieldName) => ZodString

Parameters

fieldName

string

Returns

ZodString

requiredCheckbox()

requiredCheckbox: (fieldName) => ZodBoolean

Parameters

fieldName

string

Returns

ZodBoolean

url

url: ZodString