Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support email list in the email method #2408

Closed
mdhafen opened this issue Nov 10, 2021 · 2 comments
Closed

Please support email list in the email method #2408

mdhafen opened this issue Nov 10, 2021 · 2 comments
Labels
stale Used to mark stale issues

Comments

@mdhafen
Copy link

mdhafen commented Nov 10, 2021

Quote from whatwg HTML5 spec:

A valid email address list is a set of comma-separated tokens, where each token is itself a valid email address. To obtain the list of tokens from a valid email address list, an implementation must split the string on commas.

There are many examples around the internet of custom methods to add this support. For example, from Leniel Maccaferri on stack overflow

jQuery.validator.addMethod(
    "multiemail",
     function(value, element) {
         if (this.optional(element)) // return true on optional element 
             return true;
         var emails = value.split(/[;,]+/); // split element by , and ;
         valid = true;
         for (var i in emails) {
             value = emails[i];
             valid = valid &&
                     jQuery.validator.methods.email.call(this, $.trim(value), element);
         }
         return valid;
     },

    jQuery.validator.messages.email
);

I'm happy to be able to define a custom method, but would like this support out of the box. As a user of an open source project that includes this library, I prefer this support be included instead of having to fork someone else's project code.

@RobJohnston
Copy link
Contributor

Someone can continue my open PR for this, as it doesn't seem to be going anywhere. See: #2074

@github-actions
Copy link

This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automatically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up.
Thank you for contributing :)

@github-actions github-actions bot added the stale Used to mark stale issues label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Used to mark stale issues
Projects
None yet
Development

No branches or pull requests

2 participants