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

Feature Request: reset a form #6

Open
kyeotic opened this issue Dec 17, 2022 · 3 comments
Open

Feature Request: reset a form #6

kyeotic opened this issue Dec 17, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@kyeotic
Copy link

kyeotic commented Dec 17, 2022

There does not appear to be a way to fully reset a form. Using setValue on the controls doesn't update the dirty | touched state, so any validators that fail on empty get shown. It's also a bit awkward to have to manually re-define the values instead of having a one stop form.reset() method.

@jorroll
Copy link
Owner

jorroll commented Dec 28, 2022

There does not appear to be a way to fully reset a form.

Ya, there's not a method to do this at the moment.

@jorroll jorroll added the enhancement New feature or request label Dec 28, 2022
@whoiscarlo
Copy link

I just found your blog post about this, and I know this is extremely premature seeing as I haven't looked through the repo, but if you are able to do this const controls = () => control().controls; then couldn't you create a for each loop that grabs all of the fields/ properties connected to controls and clear them out? I know it's probably a lot more complicated than that but I figured I'd at least ask.

Anyways thanks for making and sharing this component!

@jorroll
Copy link
Owner

jorroll commented Apr 12, 2023

then couldn't you create a for each loop that grabs all of the fields/ properties connected to controls and clear them out?

Not sure who your comment is directed to, but yes it is possible to manually (re)set a form control to an arbitrary state. This is a request to add a convenience method to help with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants