final-form / final-form/react-final-form

feat: submitCount OR Add onBeforeSubmit/onAfterValidation hooks

Open
#648 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

Hello, I am looking for a way to run custom actions after the user pressed Submit button and the form has been validated as invalid.

I need to scroll to first element with custom scrolling library and then to focus that element.

I have seen https://github.com/final-form/react-final-form/issues/39 and [final-form-focus](https://github.com/final-form/final-form-focus), but there is not enough space for customizations.

Solution with `onChange` also doesn't work as scrolling away and pressing Submit again won't trigger this handler (as nothing has changed).

/edit: What would be helpful is a supplement property for all `submit` that would change every time user invokes the submit action. I can think of `submitCount`.

That way, `submitFailed` would stay set and unchanged to `true`, but the submit count would correctly reflect that something has happened even though state (values) has not changed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.