No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Validate with :rules if a input v-model is an input

    Framework
    3
    10
    504
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      codethirsty last edited by codethirsty

      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?

      beets dobbel 2 Replies Last reply Reply Quote 0
      • beets
        beets @codethirsty last edited by

        @codethirsty You could just copy the email validator function from vuelidate: https://github.com/vuelidate/vuelidate/blob/master/src/validators/email.js

        C 1 Reply Last reply Reply Quote 1
        • C
          codethirsty @beets last edited by

          @beets It looks like the patterns in html.
          How can i use it inside the rules?

          beets 1 Reply Last reply Reply Quote 0
          • beets
            beets @codethirsty last edited by

            @codethirsty Something like this is the easiest way: https://codepen.io/pianopronto/pen/XWjeYvQ

            C 1 Reply Last reply Reply Quote 0
            • C
              codethirsty @beets last edited by codethirsty

              @beets thanks i will check it out

              1 Reply Last reply Reply Quote 0
              • dobbel
                dobbel @codethirsty last edited by dobbel

                @codethirsty @beets

                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=xxX81WmXjPg

                https://medium.com/hackernoon/the-100-correct-way-to-validate-email-addresses-7c4818f24643

                beets 1 Reply Last reply Reply Quote 0
                • beets
                  beets @dobbel last edited by

                  @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.

                  dobbel 1 Reply Last reply Reply Quote 0
                  • dobbel
                    dobbel @beets last edited by

                    @beets

                    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.

                    1 Reply Last reply Reply Quote 0
                    • C
                      codethirsty last edited by

                      Yes, @beets it works perfectly, thanks man!

                      1 Reply Last reply Reply Quote 0
                      • C
                        codethirsty last edited by

                        @beets @dobbel I think even so mail validation should be canonical and should be start by the client side.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post