Detecting if form has been "touched" outside of specific fields or onSubmit? #758
Unanswered
nico-martinucci
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
I am currently determining if i can use this library for my usecase and one of the requirements is this. Any answer for this? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm rendering a form inside of a modal, which has an
onCloseprop. If the form hasn't been "touched", then I want the modal to close immediately whenonCloseis fired; otherwise, I want to divert to a confirmation box before closing. This requires knowing at the parent component level whether or not the form has been "touched".I have found the
isPristineandisTouchedproperties on the object returned fromuseForm, but these don't appear to update as the form is being filled out, just when the form'sonSubmitis called. Is there something I'm missing? Some way I can force an update of these values or something else that's exposed that I'm missing? Or am I stuck managing my own "touched" state outside of the form that tracks whether an input has been touched?Here's a very basic pseudo-code example:
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions