How can I reliably extract the validation messages when a FormKit group is invalid? #1119
snoozbuster
started this conversation in
General
Replies: 0 comments
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 written some code which uses a watcher on
computed(() => node.context?.state.valid)
(wherenode
is atype="group"
node) in order to know if the formkit is currently valid, and this works well enough for a simple boolean check. However, I would rather have the specific list of errors - I tried usinggetValidationMessages
inside this watcher but it always seems to be "behind" (even if Iawait node.settled
); ie, when the node first becomes invalid,context.state.valid
is false but there are no validation messages, and when it becomes valid, the messages are still present from the previous validation. Is there a reliable way to extract the messages from the formkit node and pass them up via events? Vue events seem like a perfect solution here, but I didn't see any events emitted by FormKit for when validation changes.Beta Was this translation helpful? Give feedback.
All reactions