Validate with :rules if a input v-model is an input
-
I am trying to make all the validations with quasar rules and no external library. Is there a way to validate if the v-model is a mail with quasar rules?
-
@codethirsty You could just copy the email validator function from vuelidate: https://github.com/vuelidate/vuelidate/blob/master/src/validators/email.js
-
@beets It looks like the patterns in html.
How can i use it inside the rules? -
@codethirsty Something like this is the easiest way: https://codepen.io/pianopronto/pen/XWjeYvQ
-
@beets thanks i will check it out
-
email validators for checking validity of a users email address input, are all incorrect or incomplete.
See:
(funny and disturbing at the same time)
https://www.youtube.com/watch?v=xxX81WmXjPghttps://medium.com/hackernoon/the-100-correct-way-to-validate-email-addresses-7c4818f24643
-
@dobbel Agreed you cannot verify an email address without attempting to send an email. But I also find those sorts of articles a bit dramatic to the point that they suggest to abandon client side validation all together. IMO it depends on your user base? Programmers? Just check for an
@
. Elderly? Doesn’t hurt to check it since probably 100 out of 100 cases they’ll have something that will pass a regex like the vuelidate one. -
Agreed for the most part. But on the other side there’s nothing more frustrating than a (JS) form validator complaining your very valid email address is incorrect.
-
Yes, @beets it works perfectly, thanks man!
-