-
Notifications
You must be signed in to change notification settings - Fork 99
feat: allow reset the form with the first value his was create #442
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
base: master
Are you sure you want to change the base?
feat: allow reset the form with the first value his was create #442
Conversation
Hi @yeikel16 Given this code: const pureValue = 'pureValue';
// A control with some default value
final control = FormControl<String>(
value: pureValue,
touched: true,
);
// Change the initial value in the control
control.value = 'new value'; What would be the benefit of: control.reset() over the current implementation: control.reset(value: pureValue) |
Hello @joanpablo, right now you need to pass the value when resetting the control, forcing it to have the value to be assigned in the With this PR, simply calling the |
Hi @yeikel16, Thanks for the quick response. You are right, I fully understand now the benefits. I agree 100% with you. I would need some time to review this PR thoroughly. It is an important feature and your PR is making important changes in the core of Reactive Forms. Thanks once again for the contribution and for the patience |
…the-form-with-a-pure-value
Hey @joanpablo any chance for this to be reviewd? |
i really needed this PR now |
Sorry for the delay, everyone. I'm back and this PR is my top priority this week. I'll be also working on evaluating the library/Flutter updates and integrating them. Thanks for your patience. |
Hi @joanpablo |
Hi @joanpablo |
Connection with issue(s)
Close #436
Connected to #382
Solution description
Right now the
reset
method allow set to null the value of the control, but could not apply to change the initial value of the control when is called. This PR allows you to discard changes made to the form fields.In some forms it is necessary to update values initially provided, and in some cases it is necessary to reset them with the initial values, for example a user profile where you need to update your personal data.
Screenshots or Videos
To Do