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

formState.anyTouched #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

noisyscanner
Copy link

@thomashoneyman
Copy link
Owner

The big question here is to decide what to do with ResetField. What happens if you touch only one field then reset it? Should anyTouched be false?

@noisyscanner
Copy link
Author

Ahhhh good point. Unless we maintain a set of the keys of changed fields like touchedFields, and then anyTouched could just be a function like size touchedFields > 0?
I'm guessing this would be a Set (Variant fields). Need to do a bit of homework on Variant still but happy to try this.

@thomashoneyman
Copy link
Owner

It seems like we could also do a variation on the allTouched function that works on the FormObject which checks if any field is touched rather than all fields are touched. Perhaps that’s an easier route.

@noisyscanner
Copy link
Author

Wouldn't that rely on validation having run for the field though? So for it to work we'd need to set validateOnModify or validateOnChange for the form (or manually trigger validation), which may not be appropriate for all forms.

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

Successfully merging this pull request may close these issues.

2 participants