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

Add a Form onChange Callback #3609

Open
oliviercperrier opened this issue Aug 1, 2022 · 5 comments
Open

Add a Form onChange Callback #3609

oliviercperrier opened this issue Aug 1, 2022 · 5 comments

Comments

@oliviercperrier
Copy link

oliviercperrier commented Aug 1, 2022

Feature request

Current Behavior

Currently there is not way to detect changes globally on a Form. The only way to detect changes is to add a callback on every input fields within the form.

Desired Behavior

It would be very use full to have an onValuesChange callback function on the Form it self, pretty much like Ant Design does: here

Suggested Solution

When ever a form.handleChange is called, the onValuesChange callback must be called.

Who does this impact? Who is this for?

Would be use full to anyone.
I'm trying change the state of the submit button only when some values has changed and it would be much easier with this callback.

Describe alternatives you've considered

None

Additional context

None

@abouolia
Copy link

+1

1 similar comment
@raisaken
Copy link

raisaken commented Sep 3, 2022

+1

@pmpwith2i
Copy link

@oliviercperrier does not we have already the onChange prop for the Form component?
Like this:

<Form onChange={(e) => {console.log('form onChange', e)}}>

@fanguangyi
Copy link

@oliviercperrier does not we have already the onChange prop for the Form component? Like this:

<Form onChange={(e) => {console.log('form onChange', e)}}>

This is useless if we are using third party input components.

@pmoradei
Copy link

Hi, I agree it would be a nice feature. Meanwhile it's is possible to use useFormikContext with a useEffect hook to detect change globally on a Form as described here :

https://formik.org/docs/api/useFormikContext

Hope it helps

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

No branches or pull requests

6 participants