solid-forms
solid-forms copied to clipboard
Feature Request: reset a form
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.
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.
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!
then couldn't you create a
for each loopthat grabs all of the fields/ properties connected tocontrolsand 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.