You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New feature, allow for an optional onChange property to be supplied to formik that would allow external notification of changes before things are submitted.
For instance, we often start out not needing to know about form values until they are submitted, but occasionally we do need to do additional things based on the values as they change. So Formik could allow us to pass in an additional onChange property which will be called whenever the values change. This would allow external systems to be called as needed.
Current Behavior
There is no way to notify about field changes until submitted.
Desired Behavior
Optionally it would be good to have the ability to notify about changes. This would allow certain fields to be monitored and enable updates based on changes.
Suggested Solutions
Add optional property onChange to formik. If a function is provided then it will be called with the latest values and formik bag every time any field changes.
onChange: (values: Values, formikBag: FormikBag) {
// I can be notified of the updated values and can use them
}
Additional Information
Formik Version: v1.0.0-alpha.2
React Version: any
TypeScript Version: any
CodeSandbox Link:
OS: any
Node Version: any
Package Manager and Version: any
The text was updated successfully, but these errors were encountered:
@jaredpalmer The linked proposal was abandoned, but there are plenty of use cases for onChange. I think it's worth re-opening this. Here's one use case:
Filter form
A typical filter form doesn't have a submit button, but every interaction with selects, checkboxes, radios etc immediately update the UI. It's convenient to have an onChange as proposed above to update the UI.
Feature
New feature, allow for an optional onChange property to be supplied to formik that would allow external notification of changes before things are submitted.
For instance, we often start out not needing to know about form values until they are submitted, but occasionally we do need to do additional things based on the values as they change. So Formik could allow us to pass in an additional onChange property which will be called whenever the values change. This would allow external systems to be called as needed.
Current Behavior
There is no way to notify about field changes until submitted.
Desired Behavior
Optionally it would be good to have the ability to notify about changes. This would allow certain fields to be monitored and enable updates based on changes.
Suggested Solutions
Add optional property onChange to formik. If a function is provided then it will be called with the latest values and formik bag every time any field changes.
onChange: (values: Values, formikBag: FormikBag) {
// I can be notified of the updated values and can use them
}
Additional Information
The text was updated successfully, but these errors were encountered: