final-form / final-form/react-final-form
Add event type to validate meta parameter
- Dominant language
- JavaScript
- Stars
- 7.4k
- Forks
- 497
- PR merge metrics
- No merged PRs in 30d
Description
### Feature request
In some scenarios you may want to run certain validations depending on the event that triggered the validation.
For instance: You got a UserId field, and every time the user is typing (onChange) you want to run validations such as field is required, no uppercase allowed... and you just only want to trigger certain validations (e.g. checking against Github api if the user exists) in the (OnBlur) event
### What is the current behavior?
Right now is an all or nothing approach, run all the validations in onChange, or OnBlur.
### What is the expected behavior?
It would be great if the type of event that triggered the validation could be informed as an additional propertiy in the _meta_ param of the validate property function (in order to type it we could take benefit of Typescript: GlobalEventHandlersEventMap).
Contributor guide
Assessment
This issue has not been assessed yet.