Accessing Valibot schema params?
I have a schema:
Now want to do something like this:
Is it possible?
import * as v from 'valibot';
export const LoginSchema = v.object({
emailAddress: v.pipe(
v.string(),
v.email(),
v.nonEmpty('Email address is required'),
v.minLength(3, 'Must be a length of at least 3'),
v.maxLength(30, 'Email is too long')
),
password: v.pipe(
v.string(),
v.nonEmpty('Password is required'),
v.email(),
v.minLength(6, 'Must be a length of at least 6'),
v.maxLength(12, 'Password is too long'),
v.regex(/[A-Z]/, 'Must contain at least one capital letter'),
v.regex(
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,
'Password must contain at least one special character'
)
),
});import * as v from 'valibot';
export const LoginSchema = v.object({
emailAddress: v.pipe(
v.string(),
v.email(),
v.nonEmpty('Email address is required'),
v.minLength(3, 'Must be a length of at least 3'),
v.maxLength(30, 'Email is too long')
),
password: v.pipe(
v.string(),
v.nonEmpty('Password is required'),
v.email(),
v.minLength(6, 'Must be a length of at least 6'),
v.maxLength(12, 'Password is too long'),
v.regex(/[A-Z]/, 'Must contain at least one capital letter'),
v.regex(
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,
'Password must contain at least one special character'
)
),
});Now want to do something like this:
<form.Field
name="emailAddress"
validators={{
onChange: LoginSchema.email,
}}
><form.Field
name="emailAddress"
validators={{
onChange: LoginSchema.email,
}}
>Is it possible?