Vuelidate – A Weblog of Priyank Maniar https://priyank.rocks Articles on web development & mobile app development Sat, 25 Jul 2020 18:06:01 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 Does Vuelidate offer any emailIf or emailUnless like requiredIf or requiredUnless? https://priyank.rocks/does-vuelidate-offer-any-emailif-or-emailunless-like-requiredif-or-requiredunless/ Mon, 03 Dec 2018 18:17:37 +0000 http://priyank.rocks/?p=252 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
    }
}
]]>