0
votes

I have a Vue JS form using Vee Validate, I have a method set up where I'd like to make a particular input field valid whenever the method runs. The method runs after a button is pressed:

/**
         * Use email suggestion
         */
        setEmailSuggestion: function preventScreenAutoLock(suggestion) {
          this.formData.AppEmail = this.formData.AppEmail + suggestion
        }

I'm not sure how to go about doing this, I essentially need to remove the validation error classes, and set them to be valid

1
This should be done either on field input or blur (when you lose focus on it) or on submit of whole form.The Witness
That method runs when a button is pressed, so the user wouldn't actually be on the field.Ryan H
WIthout more code it’ll be difficult to answer.The Witness

1 Answers

0
votes

It's hard to say what you really want without more code. However, you can clear errors from the ErrorBag manually: https://baianat.github.io/vee-validate/api/errorbag.html#errorbag

And you can also use either reset or detach on that field: https://baianat.github.io/vee-validate/api/validator.html#api

Why detach? Well, if you don't care about the result of those validation rules after hitting this method, why keep it attached? You can extend again later if you want. Again, it's hard to say what you are looking for here.