/    Sign up×
Community /Pin to ProfileBookmark

Allow up to 10 emails in a textbox

Hi

Can someone help me. i am developing an asp.net web project and kind of user go to the site and send out messages to other friends (10 friends is max)

So on the site I have a textbox and I only want allow the user to enter their friends email up to 10 emails separate by comma. This is what the user input in the textbox, example: [B][email protected],[email protected][/B]

My goal are
Onclient side (This where I need javascript help)
1 – no more than 10 email
2 – validate all emails are valid format

Once the client side is passed then I do another server validation by capture all the emails input and split(comma) and put it into an array and call the function below and pass in each of the email for validation

public static bool IsValidEmail(string strEmail)
{
Regex objNotWholePattern = new Regex(@”^([a-zA-Z0-9_.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$”);
return objNotWholePattern.IsMatch(strTextEntry);
}

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @kennie_n2000 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...