Skip to content

It is not possible to access the list of errors on submit without explicitly calling the trigger method before submission. #10575

@Ploppy3

Description

@Ploppy3

Version Number

7.45.0

Codesandbox/Expo snack

https://codesandbox.io/s/flamboyant-nash-t4ljj6?file=/src/App.js

Steps to reproduce

  1. Open link
  2. Click on submit
  3. Notice that the field is not valid because it is required and therefore is focused. Though, the list of errors (available in console) is empty.

Expected behaviour

Imagine a complex multi step form in which the required field is in a previous step and therefore not visible and not focusable.

Without the list of errors, it is not possible to determine on which step the validation error occurred.

Is the only solution to call trigger() to get the list of errors before and only then submit the form?

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions