-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
How to keep field defaults updated to current values? #341
Comments
I think you need |
Aha, that does seem to work, thanks! I didn't understand what those functions did from the documentation. I just changed it to:
|
It seems that set('defaults', values) does not trigger a field's input converter to run. If I do |
Note that you have to use I don't know if I don't understood your message, but I would do just:
|
Oops, that was just a typo on my end. It is |
i have: when i set values, if the values not have
|
Say I have a form that's mapped to a model's fields. After submitting the form I want the dirty fields to be updated so that the saved values are no longer considered dirty. As far as I can tell, I need to update the field defaults to the saved values. With nested fields it gets pretty cumbersome because I can't just do something like form.update_defaults(saved_values). How can I easily map my model's updated values back onto the field defaults after a save?
Say with a schema like this:
fields = [
name: {},
email: {},
address: { fields: [{ line1: {}, line2: {}, city: {}, ... }]
]
In onSuccess() I can do form.values() to get all the dirty values, and after saving successfully I can do something like _assign(myModel, values) to update my model to the new values. But I can't see an easy way to get the new values into each field's defaults without some weird iteration and name mangling. Am I misunderstanding something about this workflow?
The text was updated successfully, but these errors were encountered: