logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.79k stars 1.26k forks source link

All errors are displayed simultaneously when using useForm.setValues(). #4474

Closed semivan closed 1 year ago

semivan commented 1 year ago

What happened?

When changing one field, errors from all fields are displayed. If you comment out the line setValues({ field1: 'qwerty' }), then the behavior will become correct.

Reproduction steps

No response

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

Relevant log output

No response

Demo link

https://stackblitz.com/edit/vitejs-vite-ywb3go?file=src%2FApp.vue

Code of Conduct

logaretm commented 1 year ago

This is intended, setValues will validate the entire form and not just the changed fields.

If you want to stop it from validating, pass false as the second argument.

setValues({ field1: 'qwerty' }, false);
semivan commented 1 year ago

If it validated when setting the field value, even for the entire form, it would be good, but it doesn't work that way. The text 'qwerty' is > 5 characters, but the error is not displayed. The behavior is completely different; errors from all fields are displayed when one field is manually changed using the keyboard.

logaretm commented 1 year ago

When the form is validated, all fields are marked as validated. This means the next time the form is validated, errors will propagate to all fields, it is similar to submitting the form and then modifying a few values.

Schema validation validates the entire form every time and not just the changed field.

Wuraim commented 7 months ago

This is intended, setValues will validate the entire form and not just the changed fields.

If you want to stop it from validating, pass false as the second argument.

setValues({ field1: 'qwerty' }, false);

Hi everyone, I don't see that boolean parameters on the documentation https://vee-validate.logaretm.com/v4/api/use-form/, is it normal ?