maxLength
function
Binds a validator to the given path that requires the length of the value to be less than or
equal to the given maxLength
.
This function can only be called on string or array paths.
In addition to binding a validator, this function adds MAX_LENGTH
property to the field.
maxLength
void
Binds a validator to the given path that requires the length of the value to be less than or
equal to the given maxLength
.
This function can only be called on string or array paths.
In addition to binding a validator, this function adds MAX_LENGTH
property to the field.
@parammaxLength
number | LogicFn<TValue, number | undefined, TPathKind>
The maximum length, or a LogicFn that returns the maximum length.
@paramconfig
BaseValidatorConfig<TValue, TPathKind> | undefined
Optional, allows providing any of the following options:
error
: Custom validation error(s) to be used instead of the defaultValidationError.maxLength(maxLength)
or a function that receives theFieldContext
and returns custom validation error(s).
@returns
void
Jump to details