Skip to content

Block Submission on Custom Error #4545

@omikader

Description

@omikader

Prerequisites

What theme are you using?

core

Version

5.20.1

Current Behavior

I am building a custom field and I'd like to implement specific validation logic that should block the submission of the form if the validation criteria are not met.

I found an example in the docs which renders a custom error but it does not actually impact the form submission at all.

I also noticed that custom errors don't appear in the customValidate or transformErrors handler arguments though I expected them to be available.

Expected Behavior

I expected the errors to bubble up to the <Form> component with some way to block submission -- ideally using the extraErrorsBlockSubmit prop.

Steps To Reproduce

https://codesandbox.io/p/sandbox/jovial-hellman-m4vrsh

Environment

- OS: MacOS 15.3.2
- Node: 20.16.0
- yarn: 1.22.22

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions