Releases: react-hook-form/resolvers
Releases · react-hook-form/resolvers
v4.0.0
4.0.0 (2025-02-10)
Bug Fixes
- add support for names option (#713) (985c48d)
- arktypeResolver: resolve type error when schema is defined from an ArkType scope (#732) (3233667)
- handle
raw: true
option to pass form submission values correctly (#733) (7807f95) - validateFieldsNatively: handle undefined object when reading 'refs' (#734) (3da2054)
Features
- ajv: Keep original validation type while using
errorMessage
(#728) (5030a59) - effectResolver: returns either all errors or only the first one based on criteriaMode (#737) (12d7d8e)
- standard-schema: add standard-schema resolver (#738) (b75a95a)
BREAKING CHANGES
- ajv: The AJV Resolver now unwraps the
errorMessage
object to return the original error types. This update may introduce breaking changes to your projects.
v3.10.0
v3.9.1
v3.9.0
3.9.0 (2024-07-05)
Features
import { useForm } from 'react-hook-form';
import { fluentValidationResolver } from '@hookform/resolvers/fluentvalidation-ts';
import { Validator } from 'fluentvalidation-ts';
class FormDataValidator extends Validator<FormData> {
constructor() {
super();
this.ruleFor('username')
.notEmpty()
.withMessage('username is a required field');
this.ruleFor('password')
.notEmpty()
.withMessage('password is a required field');
}
}
const App = () => {
const { register, handleSubmit } = useForm({
resolver: fluentValidationResolver(new FormDataValidator()),
});
return (
<form onSubmit={handleSubmit((d) => console.log(d))}>
<input {...register('username')} />
{errors.username && <span role="alert">{errors.username.message}</span>}
<input {...register('password')} />
{errors.password && <span role="alert">{errors.password.message}</span>}
<button type="submit">submit</button>
</form>
);
};
v3.8.0
v3.7.0
3.7.0 (2024-07-02)
Bug Fixes
- zodResolver: cannot read properties of undefined (reading 'length') (a3e50c6)
- chore: update valibot dependency to version >=0.33.0 (#695)
Features
import { useForm } from 'react-hook-form';
import { vineResolver } from '@hookform/resolvers/vine';
import vine from '@vinejs/vine';
const schema = vine.compile(
vine.object({
username: vine.string().minLength(1),
password: vine.string().minLength(1),
}),
);
const App = () => {
const { register, handleSubmit } = useForm({
resolver: vineResolver(schema),
});
return (
<form onSubmit={handleSubmit((d) => console.log(d))}>
<input {...register('username')} />
{errors.username && <span role="alert">{errors.username.message}</span>}
<input {...register('password')} />
{errors.password && <span role="alert">{errors.password.message}</span>}
<button type="submit">submit</button>
</form>
);
};