0
votes

Its my first time using VeeValidate. How can I enable/disable a form field just when another is valid. For example, just enable password field after veevalidate checks the user field as valid.

1
You can keep the password input filed dynamically disabled whenever user field has an error. :disabled="error.has('nameOfUserField'). - Himanshu
But i think this approach is not possible on vee-validate 3 - Pablo Souza

1 Answers

1
votes

Wrap both relevant fields in a ValidationObserver and use it's scoped prop errors to tell you when the one field is invalid. Something like this (untested):

<ValidationObserver v-slot="{ errors }">
    <ValidationProvider vid="item1" rules="required">
        <input v-model="item1" />
    </ValidationProvider>
    <ValidationProvider vid="item2" rules="required">
        <input v-model="item2" :disabled="errors.item1"/>
    </ValidationProvider>
</ValidationObserver>