Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing all values as the second parameter when calling Field's validate #3874

Open
myNameIsDu opened this issue Sep 5, 2023 · 0 comments · May be fixed by #3882
Open

passing all values as the second parameter when calling Field's validate #3874

myNameIsDu opened this issue Sep 5, 2023 · 0 comments · May be fixed by #3882

Comments

@myNameIsDu
Copy link

Feature request

passing all values as the second parameter when calling Field's validate

Current Behavior

just passes the current value as the first parameter

Desired Behavior

passing all values as the second parameter when calling Field's validate

Suggested Solution

passing all values as the second parameter when calling Field's validate

Who does this impact? Who is this for?

Describe alternatives you've considered

I have tried many alternative solutions, but I haven't found a suitable one.

Additional context

In the context of my application, there's a dynamic form, For example, it's a radio group. When I select the 'A' option, it triggers the rendering of an additional input or other components. Once rendered, this component is automatically registered and set as 'required'. On the other hand, if I opt for a selection other than 'A', different fields and components get registered. So that's the reason why I'm using Field's validate, I don't have to operate the huge schema, The Field'validae comes with automatic registration and logout

Here's the smallest reproducible example: https://stackblitz.com/edit/stackblitz-starters-pxyrgo?file=src%2FApp.tsx.
To reproduce the issue, follow these steps:

  1. Click the 'Add' button.
  2. Enter "1" into the second input.
  3. Check the console.

You'll notice that the values in the validate function are stale.

Finally, I'd like to thank you for your outstanding work in creating this invaluable form library. Regarding this issue, if you agree to add this feature, I'm more than willing to implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant