-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Validate the input after submit, and not realtime #379
Comments
You can use <input v-model="first_name" v-validate="'required|alpha'" data-vv-as="First name" name="first_name" class="form-control input-sm" placeholder="First name" type="text" data-vv-validate-on="none"> The next version will have a disabled modifier to prevent adding events: <input v-model="first_name" v-validate.disabled="'required|alpha'" data-vv-as="First name" name="first_name" class="form-control input-sm" placeholder="First name" type="text"> |
Question: has this been released? I don't find any documentation or examples on this (and it doesn't seem to work in my project, but I might be doing something else wrong). Alternative approach:
And on the submit event call I call |
You can disable listeners using the events config, just assign it to empty
string.
```js
Vue.use(VeeValidate, { events: '' });
```
Or by using the `disable` modifier. Like this:
`v-validate.disable='required'`.
I will be sure to add it to docs as it's a common need.
|
Thank you for the swift reply. |
I'm having the same issue. It seems the solution provided here is outdated, as the docs don't mention |
Nevermind, found the solution in the docs. This page was difficult to find through the search box, I found it when browsing Validation* component props btw, I think it may be useful to have a combination of passive and aggressive 🙂 if I submit a form and there are errors, switch to aggressive validation TL;DR for visitors from the future: import { setInteractionMode } from 'vee-validate'
setInteractionMode('passive') |
https://vee-validate.logaretm.com/v3/guide/interaction-and-ux.html new link for v3 |
Can we do this globally for Vue 3? |
It seems that Passive mode was removed in v4. Why is that? It's useful to only validate on form submission, as opposed to every time they leave an input field. |
Any plan to reintroduce this / motivation why it was removed? Any workarounds possible? |
By default vee-validate adds multiple event listeners to your fields, you can turn off by setting false in config. import { configure } from 'vee-validate'; this works with vue3 vee-validate 4. |
The configure function only works with Field component. Don't work with useField (composition API): https://vee-validate.logaretm.com/v4/guide/components/validation/#validation-behavior I found an example for compositionApi, but I couldn't make it work yet: https://vee-validate.logaretm.com/v4/examples/dynamic-validation-triggers/ Another thing I found is defineField function returned by useForm, but in the app I am working is running vue 3.2 :( |
Versions:
Description:
Hallo, im searching for this for hours but i cant find the answer.
I want to validate all fields on submit, and not realtime when im typing on the input field. I want to achieve something like this: http://vee-validate.logaretm.com/api.html#validator-example So when i click on the button then the it validate all the inputs and not when im typing
Can i achieve the above when i use input fields like this:
<input v-model="first_name" v-validate="'required|alpha'" data-vv-as="First name" name="first_name" class="form-control input-sm" placeholder="First name" type="text">
Or do i have to do everything in javascript like the example in the link?
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: