question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field validate function should receive field props

See original GitHub issue

Are 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:open
  • Created 6 years ago
  • Reactions:29
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
bradywatkinsoncommented, Oct 17, 2017

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

1reaction
conor909commented, May 10, 2018

@erikras There seems to be some growing interest in this, do you have any thoughts around it?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found