Skip to content

Releases: react-hook-form/resolvers

v3.9.0

05 Jul 23:11
5fc1e63
Compare
Choose a tag to compare

3.9.0 (2024-07-05)

Features

  • fluentvalidation-ts: add fluentvalidation-ts resolver (#702) (5fc1e63)
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

05 Jul 09:27
039385e
Compare
Choose a tag to compare

3.8.0 (2024-07-05)

Features

  • add typeschema resolver (#699) (18e423f), closes #693
  • typeboxResolver: make TypeBox resolver work with compiled schema (#674) (e8e0f80)

v3.7.0

02 Jul 16:34
c0d528b
Compare
Choose a tag to compare

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>
  );
};

v3.6.0

06 Jun 00:28
bdd5ef5
Compare
Choose a tag to compare

3.6.0 (2024-06-06)

Features

  • upgrade and migrate Valibot to v0.31.0 (#688) (bdd5ef5)

v3.5.0

04 Jun 23:07
c53864f
Compare
Choose a tag to compare

3.5.0 (2024-06-04)

Features

v3.4.2

20 May 22:51
Compare
Choose a tag to compare

3.4.2 (2024-05-20)

Bug Fixes

  • move back to in-build set and remove lodash.set (#685) (5754c47)

v3.4.1

20 May 22:14
bdc1f1f
Compare
Choose a tag to compare

3.4.1 (2024-05-20)

Bug Fixes

v3.4.0

15 May 00:12
79700b0
Compare
Choose a tag to compare

3.4.0 (2024-05-15)

Features

v3.3.4

04 Jan 09:06
Compare
Choose a tag to compare

3.3.4 (2024-01-04)

Bug Fixes

  • error handling for array errors with root error (1bfc6ab)

v3.3.3

26 Dec 10:24
6f1b139
Compare
Choose a tag to compare

3.3.3 (2023-12-26)

Bug Fixes