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 methods to update form data manually #52

Draft
wants to merge 5 commits into
base: typescript-2.0
Choose a base branch
from

Conversation

gwhobbs
Copy link

@gwhobbs gwhobbs commented Jun 25, 2022

Sometimes it's helpful to be able to update form data manually. For example, maybe:

  • We might want changing one field to affect the values of other fields (e.g. an array of values that must add to 100)
  • We might want a button that causes predefined changes to happen to the form data (e.g. a button that alters existing items in an array)

This PR experimentally adds two new features addressing these issues:

  1. A custom onApplyChangeToForm(formData: FormData, fieldValue: any, fieldPath: string) => FormData updater function can be provided as an option in getInputProps()
  2. An updateFormData(formData: FormData) => void function is exposed for making arbitrary changes to the form data.

Closes #41

@gwhobbs gwhobbs changed the title Add methods to update form data manually (closes #41) Add methods to update form data manually Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant