Skip to content

Please support email list in the email method #2408

Closed
@mdhafen

Description

@mdhafen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleUsed to mark stale issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions