-
Notifications
You must be signed in to change notification settings - Fork 520
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
UForm: error
event is fired only on submit
#1745
Comments
Just wanted to add that I also tried with the edge version: Thanks again |
That's right, the Do you have a particular use case in mind where triggering it on input event would be useful? |
Hello, thanks for the quick reply. |
The validate-on prop allows to control which input events will trigger validation, for example This doesn't submit the form. It just checks the input for errors and displays them to provide immediate feedback after interacting with an input. Regarding your use-case, I can't think of any nice way to implement it with the I'll think of whether it makes sense to emit errors from input events in the next major version. |
Hello, thanks for the reply and for the explanation. I managed to do what I wanted with a template ref on the form and a watcher on it. What I have now: const form = ref()
watch(
() => form.value?.errors,
() => {
const errors = schema.safeParse(state).error?.errors)
// do what you need to do with errors
},
) |
Hey! Is there any fix for that? I also have the issue, |
@romhml Is this done in |
Environment
Version
v2.15.2
Reproduction
https://stackblitz.com/edit/nuxt-ui-baglbg
Description
Hello,
I think I'm misunderstanding the UForm documentation, but from what I read in the Props I'm expecting the
error
event to be fired by the default not only when one tries to submit the form, but also on every change of the state, on every blur and on every input event of the various inputs (depending on how you customize thevalidateOn
prop).In the linked example I would expect the
console.log('onError')
to shows up on any of this events, but it's fired only on submit.I specified
:validate-on="['blur', 'input', 'submit', 'change']"
on the form, and I haveeagerValidation
set to true on the FormGroups.I'm probably missing something.
Thanks in advance, for any help would be greatly appreciated.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: