Seeking a way to watch for changes via setValue
, since <Form onChange/>
won't work
#3698
Labels
feature request
request a feature to be added
Projects
Is your feature request related to a problem? Please describe.
My current app has a number of forms with duplicated logic, so I have a
<CustomForm>
element I use to handle the logic. One of the most important parts is thatCustomForm
handles watching for changes, then sends them to an iframe to make live updates.This works great for user-initiated changes to form fields, but it fails when I need to use
setValue
, naturally because it doesn't trigger achange
event. One example is a rich text field (usingslate
). Another is a drag-and-drop avatar uploader.So I'm seeking some way to watch for all changes to the form data.
watch()
isn't a great solution because I need to know what field just changed, not just that the entire object changed. I would prefer not to do a deep equal for every character a user types, you know?Describe the solution you'd like
Some ideas:
setValue
triggers a synthetic change event.watch()
receives a callback functioncb(name, value, ref)
.Additional context
I've looked through the issues and discussion. It seems like this is a fairly common pain point. That said, I can definitely imagine I'm just missing an easy way to do this as is.
The text was updated successfully, but these errors were encountered: