Validating an email address inside a chipVuetify focus input inside v-forServer side form validation with vue.js and vuetifyEmail validation n vuetify.jsHow to validate forms inside vuetify stepper using vee-validatevuetify tags with chips using , instead of hitting enterReset Vuetify form validationTiming of validations with vuetify rulesHow to stop select from opening when closing chip in vuetify?vuetify autocomplete allow unknown items between chipsVuetify How to blur, focus out clicked chips?

Reply 'no position' while the job posting is still there

Do the concepts of IP address and network interface not belong to the same layer?

What does this horizontal bar at the first measure mean?

Has Darkwing Duck ever met Scrooge McDuck?

THT: What is a squared annular “ring”?

A Permanent Norse Presence in America

Can the Supreme Court overturn an impeachment?

Bob has never been a M before

Did US corporations pay demonstrators in the German demonstrations against article 13?

Can not upgrade Kali,not enough space in /var/cache/apt/archives

Two-sided logarithm inequality

How to decide convergence of Integrals

Can a significant change in incentives void an employment contract?

What is the gram­mat­i­cal term for “‑ed” words like these?

Customize circled numbers

Some numbers are more equivalent than others

Open a doc from terminal, but not by its name

Did arcade monitors have same pixel aspect ratio as TV sets?

Query about absorption line spectra

How do ground effect vehicles perform turns?

Drawing ramified coverings with tikz

Can a Necromancer reuse the corpses left behind from slain undead?

How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?

Could solar power be utilized and substitute coal in the 19th Century



Validating an email address inside a chip


Vuetify focus input inside v-forServer side form validation with vue.js and vuetifyEmail validation n vuetify.jsHow to validate forms inside vuetify stepper using vee-validatevuetify tags with chips using , instead of hitting enterReset Vuetify form validationTiming of validations with vuetify rulesHow to stop select from opening when closing chip in vuetify?vuetify autocomplete allow unknown items between chipsVuetify How to blur, focus out clicked chips?













0















I'm trying to create a field where user can input multiple valid email addresses. Onclick 'Enter' key, the last inputted email will be validated if it's a valid email or not. I tried to do this with what I've come up with below but I don't have enough knowledge in Vue JS or Vuetify JS. I think my method of validating an email address is incorrect ( !(v => /.+@.+/.test(v)) ), I just took it from the Vuetify JS website's Form examples. I would like to ask- what is the correct method to validate emails in this kind of case?



Here is my code:



<template>
<v-combobox v-model="chips"
label="Emails"
chips
clearable
solo
:rules="emailRules"
multiple>
<template v-slot:selection="data">
<v-chip :selected="data.selected"
close
@input="remove(data.item)">
<strong> data.item </strong>&nbsp;
</v-chip>
</template>
</v-combobox>
</template>

<script>
export default
data()
return
chips: [],
emailRules :[
v => v.length < 1)
return 'Input is required';
else if (v.length > 0)
for (let i = 0; i < v.length; i++)
if ((i == v.length-1) && !(v => /.+@.+/.test(v)))
return 'Invalid email';


else return true;

]

,

methods:
remove(item)
this.chips.splice(this.chips.indexOf(item), 1)
this.chips = [...this.chips]



</script>


Thanks a lot!










share|improve this question




























    0















    I'm trying to create a field where user can input multiple valid email addresses. Onclick 'Enter' key, the last inputted email will be validated if it's a valid email or not. I tried to do this with what I've come up with below but I don't have enough knowledge in Vue JS or Vuetify JS. I think my method of validating an email address is incorrect ( !(v => /.+@.+/.test(v)) ), I just took it from the Vuetify JS website's Form examples. I would like to ask- what is the correct method to validate emails in this kind of case?



    Here is my code:



    <template>
    <v-combobox v-model="chips"
    label="Emails"
    chips
    clearable
    solo
    :rules="emailRules"
    multiple>
    <template v-slot:selection="data">
    <v-chip :selected="data.selected"
    close
    @input="remove(data.item)">
    <strong> data.item </strong>&nbsp;
    </v-chip>
    </template>
    </v-combobox>
    </template>

    <script>
    export default
    data()
    return
    chips: [],
    emailRules :[
    v => v.length < 1)
    return 'Input is required';
    else if (v.length > 0)
    for (let i = 0; i < v.length; i++)
    if ((i == v.length-1) && !(v => /.+@.+/.test(v)))
    return 'Invalid email';


    else return true;

    ]

    ,

    methods:
    remove(item)
    this.chips.splice(this.chips.indexOf(item), 1)
    this.chips = [...this.chips]



    </script>


    Thanks a lot!










    share|improve this question


























      0












      0








      0








      I'm trying to create a field where user can input multiple valid email addresses. Onclick 'Enter' key, the last inputted email will be validated if it's a valid email or not. I tried to do this with what I've come up with below but I don't have enough knowledge in Vue JS or Vuetify JS. I think my method of validating an email address is incorrect ( !(v => /.+@.+/.test(v)) ), I just took it from the Vuetify JS website's Form examples. I would like to ask- what is the correct method to validate emails in this kind of case?



      Here is my code:



      <template>
      <v-combobox v-model="chips"
      label="Emails"
      chips
      clearable
      solo
      :rules="emailRules"
      multiple>
      <template v-slot:selection="data">
      <v-chip :selected="data.selected"
      close
      @input="remove(data.item)">
      <strong> data.item </strong>&nbsp;
      </v-chip>
      </template>
      </v-combobox>
      </template>

      <script>
      export default
      data()
      return
      chips: [],
      emailRules :[
      v => v.length < 1)
      return 'Input is required';
      else if (v.length > 0)
      for (let i = 0; i < v.length; i++)
      if ((i == v.length-1) && !(v => /.+@.+/.test(v)))
      return 'Invalid email';


      else return true;

      ]

      ,

      methods:
      remove(item)
      this.chips.splice(this.chips.indexOf(item), 1)
      this.chips = [...this.chips]



      </script>


      Thanks a lot!










      share|improve this question
















      I'm trying to create a field where user can input multiple valid email addresses. Onclick 'Enter' key, the last inputted email will be validated if it's a valid email or not. I tried to do this with what I've come up with below but I don't have enough knowledge in Vue JS or Vuetify JS. I think my method of validating an email address is incorrect ( !(v => /.+@.+/.test(v)) ), I just took it from the Vuetify JS website's Form examples. I would like to ask- what is the correct method to validate emails in this kind of case?



      Here is my code:



      <template>
      <v-combobox v-model="chips"
      label="Emails"
      chips
      clearable
      solo
      :rules="emailRules"
      multiple>
      <template v-slot:selection="data">
      <v-chip :selected="data.selected"
      close
      @input="remove(data.item)">
      <strong> data.item </strong>&nbsp;
      </v-chip>
      </template>
      </v-combobox>
      </template>

      <script>
      export default
      data()
      return
      chips: [],
      emailRules :[
      v => v.length < 1)
      return 'Input is required';
      else if (v.length > 0)
      for (let i = 0; i < v.length; i++)
      if ((i == v.length-1) && !(v => /.+@.+/.test(v)))
      return 'Invalid email';


      else return true;

      ]

      ,

      methods:
      remove(item)
      this.chips.splice(this.chips.indexOf(item), 1)
      this.chips = [...this.chips]



      </script>


      Thanks a lot!







      vue.js vuetify.js






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 7:31







      blopblopblop

















      asked Mar 8 at 6:30









      blopblopblopblopblopblop

      134




      134






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I did it like this:



          if (!(/^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]1,3.[0-9]1,3.[0-9]1,3.[0-9]1,3])|(([a-zA-Z-0-9]+.)+[a-zA-Z]2,24))$/.test(v[i]))) 
          return 'Invalid email';



          It now works.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057875%2fvalidating-an-email-address-inside-a-chip%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I did it like this:



            if (!(/^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]1,3.[0-9]1,3.[0-9]1,3.[0-9]1,3])|(([a-zA-Z-0-9]+.)+[a-zA-Z]2,24))$/.test(v[i]))) 
            return 'Invalid email';



            It now works.






            share|improve this answer



























              0














              I did it like this:



              if (!(/^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]1,3.[0-9]1,3.[0-9]1,3.[0-9]1,3])|(([a-zA-Z-0-9]+.)+[a-zA-Z]2,24))$/.test(v[i]))) 
              return 'Invalid email';



              It now works.






              share|improve this answer

























                0












                0








                0







                I did it like this:



                if (!(/^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]1,3.[0-9]1,3.[0-9]1,3.[0-9]1,3])|(([a-zA-Z-0-9]+.)+[a-zA-Z]2,24))$/.test(v[i]))) 
                return 'Invalid email';



                It now works.






                share|improve this answer













                I did it like this:



                if (!(/^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]1,3.[0-9]1,3.[0-9]1,3.[0-9]1,3])|(([a-zA-Z-0-9]+.)+[a-zA-Z]2,24))$/.test(v[i]))) 
                return 'Invalid email';



                It now works.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 8 at 9:12









                blopblopblopblopblopblop

                134




                134





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057875%2fvalidating-an-email-address-inside-a-chip%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown