Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Multiple Email validation in portal using Javascript

Posted on by Microsoft Employee

Hi,

I am working on one requirement where I have to store multiple email addresses in one field. I want to validate all email address using Javascript on save of the form.

Input Email : abc@gmail.com;test@gmail.com;xyz@gmail.com 

I want to validate all 3 email addresses.

Is there a way we can do that?

Thanks,

Akash

  • Suggested answer
    ritam.giri Profile Picture
    ritam.giri 20 on at
    RE: Multiple Email validation in portal using Javascript
    You can use these following two functions combined..I hope it'll help.
     
    function validateEmail(field) {
        var regax =/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2.4}\b/i;
        return (regax.test(field)) ? true : false;
    }

    function validateMultipleEmail(value) {
        var result = value.split(";");
        for (var i = 0; i < result.length; i++)
        if(!validateEmail(result[i]))
                return false;
        return true;
    }
  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: Multiple Email validation in portal using Javascript

    Hi,

    In portal, you can write Javascript to validate email id like:

    1. Split the entered text by using Semicolon characters.

    2. After splitting, we will get the array then we can validate each value using regex expression.

    Thanks,
    Pradeep.

    Please mark this as VERIFIED, if it helps. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans