-
Notifications
You must be signed in to change notification settings - Fork 32
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
initialize application form with resource attributes by default #105
Comments
It makes sense to me though I have no experience with this use case. @vvmarulin? |
Once we get to the next phase of vmx we should just audit the custom form objects and see how often this pattern is used, that can be a heuristic for whether or not this will be a sensible default 👍 |
@hiattp any new thoughts on this given that we have more experience with the subject now? |
Yep, we actually made this change in VmX almost a year ago and it seems to be working well I think it is template-worthy at this point 👍 |
Whenever I override the initialize method in
ApplicationForm
I use the resource attributes as the defaultparams
instead of{}
. This provides more intuitive behavior because you can initialize the form object passing only the resource and the form object will behave (state-wise) as the object itself (default values are set to whatever the current resource values are). Otherwise you can pass a user into the form initializer and no params (e.g. on an edit action) and see no default values populating the form.I suggest we do something more like this in the application form, but wanted to propose it as a question first in case I'm missing any obvious disadvantages here:
The text was updated successfully, but these errors were encountered: