Skip to main content
VueVuelidate

Does Vuelidate offer any emailIf or emailUnless like requiredIf or requiredUnless?

By December 3, 2018July 25th, 2020No Comments

The answer is no but we still have a problem that we need to solve. What do we do now?

Well, the answer is we don’t need to worry about it. If the condition for required is not met, the email rule should not apply and it doesn’t. Form submits as you would expect (without any errors). However, if user types in the email anyway then Vuelidate expects it to be in a proper format.

Following is just fine.

1
2
3
4
5
6
validations: {
letter_email_address: {
    required: requiredUnless('isLetter'),
          email
    }
}
Close Menu