Field validate function should receive field props
See original GitHub issueAre you submitting a bug report or a feature request?
Feature Request
What is the current behavior?
Signature is:
function validate(props, allValues, formProps, name)
What is the expected behavior?
function validate(props, allValues, formProps, name, fieldProps)
(Or)
function validate({ props, allValues, formProps, name, fieldProps })
Other information
I have a setup where the validate definition is decoupled from the ReduxForm.Field’s props. I want to be able to change the validation at runtime based on config variables in the WrappedField’s props. This needs to be done on a per-field basis.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:29
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Final Form Docs – `FieldProps`
A function that takes the field value, all the values of the form and the meta data about the field and returns an...
Read more >Custom props are not being passed into Field's validate function
***> wrote: Along the lines of custom FIELD props being passed down, I am trying to validate a Field using a custom array...
Read more >How to validate React props using PropTypes - LogRocket Blog
Learn how to validate props with React PropTypes, React's internal mechanism for adding type checking to component props.
Read more >Field-Level Validation Example - Redux Form
The parameters to the validation function are: value - The current value of the field; allValues - The values of the entire form;...
Read more >How to pass custom props to validate function in redux-form?
@YuryTarabanko i changed the validate function to test it out on the individual Field components and not the form, but either way even...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just wondering what the latest on this proposal is. It seems to me that a more robust pattern (at least what I personally have implemented) is to have the fields responsible for their own validation rather than the form. That being the case, having access to their own state will provide greater granular control
@erikras There seems to be some growing interest in this, do you have any thoughts around it?