npm vee-validate 4.2.1

latest releases: 4.12.6, 4.12.5, 4.12.4...
3 years ago

This release fixes some issues introduced in 4.2.1 due to the limitations mentioned in #3189

Enahanced valid flag behavior

Instead of having the valid flag starts with either true or false, it will have its own validation ecosystem where silent validations would be run when:

  • The field is mounted
  • The field value changed

This means you can now always rely on the valid flag to present the accurate form state, note that the valid flag is now completely independent from the errors array as it can be false while there are no errors. But the opposite is not true, the valid flag cannot be true while there are some errors.

Until that silent validation is run, the valid flag will be true, so it is still good idea to combine it with dirty or touched as to avoid this issue.

This change makes easier to disable various UI elements based on the validity and interactivity with the form, here are some common ones:

Expression Description
valid Form/Field is valid or might've not been validated yet
!valid Form/Field is invalid
valid && dirty Form/Field is valid and some values have been changed
valid && touched Form/Field is valid and the user blurred some controls
!valid || !dirty Form/Field is invalid or no value was changed yet (good for disabling submit buttons)

Don't miss a new vee-validate release

NewReleases is sending notifications on new releases.