Hi,

you have the same error as above.

Having a return statement in a for loop will evaluate the first element only.
If you want to validate all emails that's a logical AND conjunction of
all single email validations. So you have to have some and function in
your code as well.
Try something like:

valid = true;
for(var i in emails) {
    value = emails[i];
    valid = valid && jQuery.validator.methods.email.call(this, value,
element, param);
}
return valid;

by(e)
Stephan

2009/3/2 ml2009 <mcl...@systemsview.biz>:
>
> Hello - wonder if you could help me.  I tried another way to validate
> multiple email addresses, but I still couldn't figure it out. on code
> below, only the first email is validated.  Any suggestions?
>
>
> jQuery.validator.addMethod("multiemail", function(value, element,
> param) {
> if (this.optional(element)) // return true on optional element
>                           return true;
>                var emails = value.split(',');
>
>                //      for(var i = 0; i < emails.length; i++) {
>                 for(var i in emails) {
>                        value = emails[i];
>                        //alert(i);
>                                        return 
> jQuery.validator.methods.email.call(this, value, element,
> param);
>                }
>        },
>    jQuery.validator.messages.email // use default message
>  );

Reply via email to