[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-04-23 Thread ml2009

Hi Roryreiff - thank you so much.

Someone helped me out the other day.  Here is another version:


multiemail: function(value, element) {
 if (this.optional(element)) // return true on optional 
element
 return true;
var emails = value.split( new RegExp( "\\s*,\\s*", "gi" ) );
valid = true;
 for(var i in emails) {
value = emails[i];
valid=valid && 
jQuery.validator.methods.email.call(this, value,
element);
}
return valid;

},

On Apr 1, 12:14 pm, roryreiff  wrote:
> ml2009,
>
> I seem to have it working within the confines of validating multiple
> email addresses within the plugin's reg exp. I made the validation
> check run only if the email length is greater than one...this takes
> care of the case when a user has a comma after the last email address
> (i.e., this prevents validation on the empty list or empty list with
> space). I also remove any whitespaces before or after each email
> address. Hopefully this will help:
>
> email: function(value, element) {
>                         if(this.optional(element))
>                         {
>                                 return true;
>                         }
>                         var valid = true;
>                         var emails = value.split(",");
>                         for(var i in emails)
>                         {
>                                 emailAddress = Trim(emails[i]);
>                                 if (emailAddress.length > 0) {
>                                         valid = valid && 
> /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-
> \/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)
> \x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f
> \x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
> \uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@
> ((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-
> \uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-
> \uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
> \uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|
> \.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF
> \uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
>                                 }
>                         }
>                         return valid;
>                 },
>
> // remove whitespaces at beginning and end of string
> function Trim(str){
>           while(str.charAt(0) == (" ") )
>           {  str = str.substring(1);
>           }
>           while(str.charAt(str.length-1) == " " )
>           {  str = str.substring(0,str.length-1);
>           }
>           return str;
>         }
>
> On Mar 2, 10:06 am,ml2009 wrote:
>
>
>
> > Hi Stephan - thank you so much for your response.
>
> > I keep trying, but being unsuccessful.  I tried valid = valid &&,
> > (valid=valid) &&, and (valid == valid) &&, but I get a syntax error
> > reference in Firebug. I even tried declaring
>
> >  var valid = (value.length > 0); // make sure that value is not empty
>
> > outside the for loop with a conditional statement if(valid==true)
> > inside the for loop, but I am sure I'm doing something wrong.  could
> > you help again?
>
> > jQuery.validator.addMethod("multiemail", function(value, element)
> > {
> > if (this.optional(element)) // return true on optional element
> >                            return true;
> >                 var emails = value.split(',');
> >                                 valid = true;
> >                          for(var i in emails) {
> >                                 value = emails[i];
> >                                         valid=valid &&  return 
> > jQuery.validator.methods.email.call(this,
> > value, element);
> >                                 }
> >                 }
> >                         return valid;
> >                         },
> >    jQuery.validator.messages.email // use default message
> >   );
>
> > On Mar 2, 2:50 am, Stephan Veigl  wrote:
>
> > > 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.valida

[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-04-01 Thread roryreiff

ml2009,

I seem to have it working within the confines of validating multiple
email addresses within the plugin's reg exp. I made the validation
check run only if the email length is greater than one...this takes
care of the case when a user has a comma after the last email address
(i.e., this prevents validation on the empty list or empty list with
space). I also remove any whitespaces before or after each email
address. Hopefully this will help:

email: function(value, element) {
if(this.optional(element))
{
return true;
}
var valid = true;
var emails = value.split(",");
for(var i in emails)
{
emailAddress = Trim(emails[i]);
if (emailAddress.length > 0) {
valid = valid && 
/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-
\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)
\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f
\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@
((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-
\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-
\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|
\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF
\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
}
}
return valid;
},

// remove whitespaces at beginning and end of string
function Trim(str){
  while(str.charAt(0) == (" ") )
  {  str = str.substring(1);
  }
  while(str.charAt(str.length-1) == " " )
  {  str = str.substring(0,str.length-1);
  }
  return str;
}




On Mar 2, 10:06 am, ml2009  wrote:
> Hi Stephan - thank you so much for your response.
>
> I keep trying, but being unsuccessful.  I tried valid = valid &&,
> (valid=valid) &&, and (valid == valid) &&, but I get a syntax error
> reference in Firebug. I even tried declaring
>
>  var valid = (value.length > 0); // make sure that value is not empty
>
> outside the for loop with a conditional statement if(valid==true)
> inside the for loop, but I am sure I'm doing something wrong.  could
> you help again?
>
> jQuery.validator.addMethod("multiemail", function(value, element)
> {
> if (this.optional(element)) // return true on optional element
>                            return true;
>                 var emails = value.split(',');
>                                 valid = true;
>                          for(var i in emails) {
>                                 value = emails[i];
>                                         valid=valid &&  return 
> jQuery.validator.methods.email.call(this,
> value, element);
>                                 }
>                 }
>                         return valid;
>                         },
>    jQuery.validator.messages.email // use default message
>   );
>
> On Mar 2, 2:50 am, Stephan Veigl  wrote:
>
> > 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 :
>
> > > 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] Re: jQuery validation question: validating multiple email inputs

2009-04-01 Thread roryreiff

ml2009,

I seem to have it working within the confines of validating multiple
email addresses within the plugin's reg exp. I made the validation
check run only if the email length is greater than one...this takes
care of the case when a user has a comma after the last email address
(i.e., this prevents validation on the empty list or empty list with
space). I also remove any whitespaces before or after each email
address. Hopefully this will help:

email: function(value, element) {
if(this.optional(element))
{
return true;
}
var valid = true;
var emails = value.split(",");
for(var i in emails)
{
emailAddress = Trim(emails[i]);
if (emailAddress.length > 0) {
valid = valid && 
/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-
\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)
\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f
\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@
((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-
\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-
\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|
\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF
\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
}
}
return valid;
},

// remove whitespaces at beginning and end of string
function Trim(str){
  while(str.charAt(0) == (" ") )
  {  str = str.substring(1);
  }
  while(str.charAt(str.length-1) == " " )
  {  str = str.substring(0,str.length-1);
  }
  return str;
}




On Mar 2, 10:06 am, ml2009  wrote:
> Hi Stephan - thank you so much for your response.
>
> I keep trying, but being unsuccessful.  I tried valid = valid &&,
> (valid=valid) &&, and (valid == valid) &&, but I get a syntax error
> reference in Firebug. I even tried declaring
>
>  var valid = (value.length > 0); // make sure that value is not empty
>
> outside the for loop with a conditional statement if(valid==true)
> inside the for loop, but I am sure I'm doing something wrong.  could
> you help again?
>
> jQuery.validator.addMethod("multiemail", function(value, element)
> {
> if (this.optional(element)) // return true on optional element
>                            return true;
>                 var emails = value.split(',');
>                                 valid = true;
>                          for(var i in emails) {
>                                 value = emails[i];
>                                         valid=valid &&  return 
> jQuery.validator.methods.email.call(this,
> value, element);
>                                 }
>                 }
>                         return valid;
>                         },
>    jQuery.validator.messages.email // use default message
>   );
>
> On Mar 2, 2:50 am, Stephan Veigl  wrote:
>
> > 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 :
>
> > > 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] Re: jQuery validation question: validating multiple email inputs

2009-03-02 Thread ml2009

Hi Stephan - thank you so much for your response.

I keep trying, but being unsuccessful.  I tried valid = valid &&,
(valid=valid) &&, and (valid == valid) &&, but I get a syntax error
reference in Firebug. I even tried declaring

 var valid = (value.length > 0); // make sure that value is not empty

outside the for loop with a conditional statement if(valid==true)
inside the for loop, but I am sure I'm doing something wrong.  could
you help again?



jQuery.validator.addMethod("multiemail", function(value, element)
{
if (this.optional(element)) // return true on optional element
   return true;
var emails = value.split(',');
valid = true;
 for(var i in emails) {
value = emails[i];
valid=valid &&  return 
jQuery.validator.methods.email.call(this,
value, element);
}
}
return valid;
},
   jQuery.validator.messages.email // use default message
  );

On Mar 2, 2:50 am, Stephan Veigl  wrote:
> 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 :
>
>
>
>
>
> > 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
> >  );- Hide quoted text -
>
> - Show quoted text -


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-03-01 Thread Stephan Veigl

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 :
>
> 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
>  );


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-03-01 Thread ml2009

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
  );


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-28 Thread ml2009

trying to do the same type of validation, but it didn't work for me.
Could you please help?


multiemail: function(value, element) {
  if (this.optional(element)) // return true on 
optional element
return true;
  var emails = value.split(',');
   var valid = (value.length > 0); // make sure that 
value is not
empty
for(var emailAddress in emails)
  {
  valid = valid && /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-
\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)
\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f
\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@
((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-
\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-
\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|
\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF
\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
}
  return valid;
},

On Feb 18, 3:39 am, Stephan Veigl  wrote:
> Hi,
>
> Taking a second look on your code it's clear why only the first email
> address is validated: you have a return statement in your for loop.
>
> try something like:
>
> email: function(value, element) {
>   if (this.optional(element)) // return true on optional element
> (whatever this is for?)
>     return true;
>   var emails = value.split(,);
>   var valid = (value.length > 0); // make sure that value is not empty
>   for(var emailAddress in emails)
>   {
>     valid = valid && /.../i.test(emailAddress); // logical and of all
> email validations
>   }
>   return valid;
>
> }
>
> by(e)
> Stephan
>
> 2009/2/17 roryreiff :
>
>
>
>
>
> > Yeah, I actually have that fixed in the posted link, but thanks for
> > pointing that out. So, something else is at error now.
>
> > On Feb 17, 9:04 am, Stephan Veigl  wrote:
> >> Hi
>
> >> is this just a copy & paste error, or a real syntax error? You have to
> >> quote the comma in your split command:
> >>   var emails = value.split(",");
>
> >> by(e)
> >> Stephan
>
> >> 2009/2/17roryreiff:
>
> >> > So far, I have adapted this:
>
> >> > email: function(value, element) {
> >> >                        return this.optional(element) || 
> >> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> >> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> >> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> >> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> >> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> >> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> >> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> >> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> >> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> >> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> >> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> >> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
> >> >                },
>
> >> > into this:
>
> >> > email: function(value, element) {
> >> >                        var emails = value.split(,);
> >> >                        for(var emailAddress in emails)
> >> >                        {
> >> >                                return this.optional(element) || 
> >> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> >> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> >> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> >> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> >> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> >> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> >> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> >> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> >> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> >> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900

[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-28 Thread ml2009

trying to do the same type of validation, but it didn't work for me.
could you please help?

multiemail: function(value, element) {
 if (this.optional(element)) // return true on optional element
 return true;
  var emails = value.split(',');
   var valid = (value.length > 0); // make sure that value is not
empty
for(var emailAddress in emails)
  {
  valid = valid && /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-
\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)
\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f
\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@
((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-
\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-
\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-
\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|
\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF
\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
}
  return valid;
},





On Feb 18, 3:39 am, Stephan Veigl  wrote:
> Hi,
>
> Taking a second look on your code it's clear why only the first email
> address is validated: you have a return statement in your for loop.
>
> try something like:
>
> email: function(value, element) {
>   if (this.optional(element)) // return true on optional element
> (whatever this is for?)
>     return true;
>   var emails = value.split(,);
>   var valid = (value.length > 0); // make sure that value is not empty
>   for(var emailAddress in emails)
>   {
>     valid = valid && /.../i.test(emailAddress); // logical and of all
> email validations
>   }
>   return valid;
>
> }
>
> by(e)
> Stephan
>
> 2009/2/17 roryreiff :
>
>
>
>
>
> > Yeah, I actually have that fixed in the posted link, but thanks for
> > pointing that out. So, something else is at error now.
>
> > On Feb 17, 9:04 am, Stephan Veigl  wrote:
> >> Hi
>
> >> is this just a copy & paste error, or a real syntax error? You have to
> >> quote the comma in your split command:
> >>   var emails = value.split(",");
>
> >> by(e)
> >> Stephan
>
> >> 2009/2/17roryreiff:
>
> >> > So far, I have adapted this:
>
> >> > email: function(value, element) {
> >> >                        return this.optional(element) || 
> >> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> >> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> >> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> >> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> >> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> >> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> >> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> >> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> >> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> >> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> >> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> >> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
> >> >                },
>
> >> > into this:
>
> >> > email: function(value, element) {
> >> >                        var emails = value.split(,);
> >> >                        for(var emailAddress in emails)
> >> >                        {
> >> >                                return this.optional(element) || 
> >> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> >> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> >> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> >> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> >> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> >> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> >> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> >> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> >> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> >> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> >> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> >> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|

[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-18 Thread Stephan Veigl

Hi,

Taking a second look on your code it's clear why only the first email
address is validated: you have a return statement in your for loop.

try something like:

email: function(value, element) {
  if (this.optional(element)) // return true on optional element
(whatever this is for?)
return true;
  var emails = value.split(,);
  var valid = (value.length > 0); // make sure that value is not empty
  for(var emailAddress in emails)
  {
valid = valid && /.../i.test(emailAddress); // logical and of all
email validations
  }
  return valid;
}

by(e)
Stephan

2009/2/17 roryreiff :
>
> Yeah, I actually have that fixed in the posted link, but thanks for
> pointing that out. So, something else is at error now.
>
> On Feb 17, 9:04 am, Stephan Veigl  wrote:
>> Hi
>>
>> is this just a copy & paste error, or a real syntax error? You have to
>> quote the comma in your split command:
>>   var emails = value.split(",");
>>
>> by(e)
>> Stephan
>>
>> 2009/2/17roryreiff:
>>
>>
>>
>> > So far, I have adapted this:
>>
>> > email: function(value, element) {
>> >return this.optional(element) || 
>> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
>> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
>> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
>> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
>> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
>> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
>> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
>> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
>> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
>> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
>> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
>> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
>> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
>> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
>> >},
>>
>> > into this:
>>
>> > email: function(value, element) {
>> >var emails = value.split(,);
>> >for(var emailAddress in emails)
>> >{
>> >return this.optional(element) || 
>> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
>> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
>> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
>> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
>> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
>> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
>> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
>> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
>> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
>> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
>> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
>> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
>> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
>> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
>> >}
>> >},
>>
>> > any thoughts why this is not working? Thanks,
>>
>> > On Feb 13, 11:10 am, Ed Lerner  wrote:
>> >> I'm new to jQuery as well. In other languages, you would take the
>> >> string that holds all of the emails and do a 'split' on commas. This
>> >> should give you an array where each element is an individual email.
>> >> From there, just validate each element.
>> >> How to do this in jQuery, someone more experienced than I may be able
>> >> to help with.
>>
>> >> On Feb 13, 11:28 am,roryreiff wrote:
>>
>> >> > Hi there,
>>
>> >> > I am using the Validation plugin to validate a form that emails the
>> >> > current pages URL to the recipients entered in to the "email to"
>> >> > field. I want to validate that field for multiple emails addressed
>> >> > separated by commas...and ideas on how to do this? I'm a bit new to
>> >> > jQuery so I am a little confused how to approach this. I was thinking
>> >> > somehow altering the email function so that is parses the input and
>> >> > does a for each on every email address. Is this correct thinking? Is
>> >> > there an easier way to do this?
>>
>> >> > Thanks,


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-17 Thread roryreiff

Yeah, I actually have that fixed in the posted link, but thanks for
pointing that out. So, something else is at error now.

On Feb 17, 9:04 am, Stephan Veigl  wrote:
> Hi
>
> is this just a copy & paste error, or a real syntax error? You have to
> quote the comma in your split command:
>   var emails = value.split(",");
>
> by(e)
> Stephan
>
> 2009/2/17roryreiff:
>
>
>
> > So far, I have adapted this:
>
> > email: function(value, element) {
> >                        return this.optional(element) || 
> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
> >                },
>
> > into this:
>
> > email: function(value, element) {
> >                        var emails = value.split(,);
> >                        for(var emailAddress in emails)
> >                        {
> >                                return this.optional(element) || 
> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
> >                        }
> >                },
>
> > any thoughts why this is not working? Thanks,
>
> > On Feb 13, 11:10 am, Ed Lerner  wrote:
> >> I'm new to jQuery as well. In other languages, you would take the
> >> string that holds all of the emails and do a 'split' on commas. This
> >> should give you an array where each element is an individual email.
> >> From there, just validate each element.
> >> How to do this in jQuery, someone more experienced than I may be able
> >> to help with.
>
> >> On Feb 13, 11:28 am,roryreiff wrote:
>
> >> > Hi there,
>
> >> > I am using the Validation plugin to validate a form that emails the
> >> > current pages URL to the recipients entered in to the "email to"
> >> > field. I want to validate that field for multiple emails addressed
> >> > separated by commas...and ideas on how to do this? I'm a bit new to
> >> > jQuery so I am a little confused how to approach this. I was thinking
> >> > somehow altering the email function so that is parses the input and
> >> > does a for each on every email address. Is this correct thinking? Is
> >> > there an easier way to do this?
>
> >> > Thanks,


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-17 Thread Stephan Veigl

Hi

is this just a copy & paste error, or a real syntax error? You have to
quote the comma in your split command:
  var emails = value.split(",");

by(e)
Stephan


2009/2/17 roryreiff :
>
> So far, I have adapted this:
>
> email: function(value, element) {
>return this.optional(element) || 
> /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
>},
>
> into this:
>
> email: function(value, element) {
>var emails = value.split(,);
>for(var emailAddress in emails)
>{
>return this.optional(element) || 
> /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
>}
>},
>
> any thoughts why this is not working? Thanks,
>
> On Feb 13, 11:10 am, Ed Lerner  wrote:
>> I'm new to jQuery as well. In other languages, you would take the
>> string that holds all of the emails and do a 'split' on commas. This
>> should give you an array where each element is an individual email.
>> From there, just validate each element.
>> How to do this in jQuery, someone more experienced than I may be able
>> to help with.
>>
>> On Feb 13, 11:28 am,roryreiff wrote:
>>
>> > Hi there,
>>
>> > I am using the Validation plugin to validate a form that emails the
>> > current pages URL to the recipients entered in to the "email to"
>> > field. I want to validate that field for multiple emails addressed
>> > separated by commas...and ideas on how to do this? I'm a bit new to
>> > jQuery so I am a little confused how to approach this. I was thinking
>> > somehow altering the email function so that is parses the input and
>> > does a for each on every email address. Is this correct thinking? Is
>> > there an easier way to do this?
>>
>> > Thanks,


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-17 Thread roryreiff

Rob,

By not working I mean that it now will not return an error message
when the first input is a well formed email. So, I could put in the
following (correctly formed email, incorrectly formed email + and
number of items) and it is validating that field, i.e. not producing
the error message. I want it to only validate when all the input email
addresses are well formed.

I will look into what you have put above, though I am wondering if
there is something I am missing with what I  have so far that will
force the validation plugin email method, which I have adapted, to
consider all the inputs in the to field. It seems to only be taking
into consideration the first. Perhaps the problem exists in using a
for loop? Is that loop ending as soon as a well formed email address
is encountered?

Thanks so much for the help,

On Feb 16, 8:03 pm, RobG  wrote:
> On Feb 17, 10:53 am, roryreiff  wrote:
>
>
>
> > So far, I have adapted this:
>
> [...]
> > into this:
>
> > email: function(value, element) {
> >                         var emails = value.split(,);
> >                         for(var emailAddress in emails)
> >                         {
> >                                 return this.optional(element) || 
> > /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> > \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> > $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> > *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> > \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> > \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> > \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> > (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> > z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> > \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> > \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> > z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> > [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
> >                         }
> >                 },
>
> > any thoughts why this is not working? Thanks,
>
> What does "not work" mean?  Does it reject valid addresses?  Allow
> invalid addresses?  It is at least scrupulously complex. :-)
>
> How about simply testing for something basic like /^[^\...@[^\s]+$/
> and leaving it at that?  You can't trust that your client-side script
> has validated the string before being sent, so you have to do whatever
> processing you require on the server anyway.
>
> The fact that the address is well-formed (per RFC 5321 and RFC 5322)
> doesn't mean it is valid (as in working or exists).
>
> If you are expecting a comma separated list, consider something like:
>
>   var addresses = '@foo.com, a...@foo.com, st...@bar.com';
>   var valid;
>   $((addresses).split(',')).each(
>     (function() {
>       var re = /^[^\...@[^\s]+$/;
>       return function(i, s) {
>         valid = re.test(jQuery.trim(s));
>         return valid;
>       };
>     })());
>   alert(valid);
>
> --
> Rob


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-16 Thread RobG



On Feb 17, 10:53 am, roryreiff  wrote:
> So far, I have adapted this:
>
[...]
> into this:
>
> email: function(value, element) {
> var emails = value.split(,);
> for(var emailAddress in emails)
> {
> return this.optional(element) || 
> /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
> }
> },
>
> any thoughts why this is not working? Thanks,

What does "not work" mean?  Does it reject valid addresses?  Allow
invalid addresses?  It is at least scrupulously complex. :-)

How about simply testing for something basic like /^[^\...@[^\s]+$/
and leaving it at that?  You can't trust that your client-side script
has validated the string before being sent, so you have to do whatever
processing you require on the server anyway.

The fact that the address is well-formed (per RFC 5321 and RFC 5322)
doesn't mean it is valid (as in working or exists).

If you are expecting a comma separated list, consider something like:

  var addresses = 'b...@foo.com, a...@foo.com, st...@bar.com';
  var valid;
  $((addresses).split(',')).each(
(function() {
  var re = /^[^\...@[^\s]+$/;
  return function(i, s) {
valid = re.test(jQuery.trim(s));
return valid;
  };
})());
  alert(valid);


--
Rob


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-16 Thread roryreiff

Allow me to show you what I have so far. It seems to validate base on
the first email, but none of the successive ones, in regards to the to
field: http://www.pomona.edu/asp/mailthis-redux.asp



On Feb 16, 4:53 pm, roryreiff  wrote:
> So far, I have adapted this:
>
> email: function(value, element) {
>                         return this.optional(element) || 
> /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
>                 },
>
> into this:
>
> email: function(value, element) {
>                         var emails = value.split(,);
>                         for(var emailAddress in emails)
>                         {
>                                 return this.optional(element) || 
> /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
> \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
> $%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
> *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
> \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
> \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
> (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
> z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
> \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
> \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
> z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
> [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
>                         }
>                 },
>
> any thoughts why this is not working? Thanks,
>
> On Feb 13, 11:10 am, Ed Lerner  wrote:
>
> > I'm new to jQuery as well. In other languages, you would take the
> > string that holds all of the emails and do a 'split' on commas. This
> > should give you an array where each element is an individual email.
> > From there, just validate each element.
> > How to do this in jQuery, someone more experienced than I may be able
> > to help with.
>
> > On Feb 13, 11:28 am,roryreiff wrote:
>
> > > Hi there,
>
> > > I am using the Validation plugin to validate a form that emails the
> > > current pages URL to the recipients entered in to the "email to"
> > > field. I want to validate that field for multiple emails addressed
> > > separated by commas...and ideas on how to do this? I'm a bit new to
> > > jQuery so I am a little confused how to approach this. I was thinking
> > > somehow altering the email function so that is parses the input and
> > > does a for each on every email address. Is this correct thinking? Is
> > > there an easier way to do this?
>
> > > Thanks,


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-16 Thread roryreiff

So far, I have adapted this:

email: function(value, element) {
return this.optional(element) || 
/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
*)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
\uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
},

into this:

email: function(value, element) {
var emails = value.split(,);
for(var emailAddress in emails)
{
return this.optional(element) || 
/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?
\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\
$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)
*)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c
\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-
\uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?
(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-
z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF
\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF
\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress);
}
},

any thoughts why this is not working? Thanks,

On Feb 13, 11:10 am, Ed Lerner  wrote:
> I'm new to jQuery as well. In other languages, you would take the
> string that holds all of the emails and do a 'split' on commas. This
> should give you an array where each element is an individual email.
> From there, just validate each element.
> How to do this in jQuery, someone more experienced than I may be able
> to help with.
>
> On Feb 13, 11:28 am,roryreiff wrote:
>
> > Hi there,
>
> > I am using the Validation plugin to validate a form that emails the
> > current pages URL to the recipients entered in to the "email to"
> > field. I want to validate that field for multiple emails addressed
> > separated by commas...and ideas on how to do this? I'm a bit new to
> > jQuery so I am a little confused how to approach this. I was thinking
> > somehow altering the email function so that is parses the input and
> > does a for each on every email address. Is this correct thinking? Is
> > there an easier way to do this?
>
> > Thanks,


[jQuery] Re: jQuery validation question: validating multiple email inputs

2009-02-13 Thread Ed Lerner

I'm new to jQuery as well. In other languages, you would take the
string that holds all of the emails and do a 'split' on commas. This
should give you an array where each element is an individual email.
>From there, just validate each element.
How to do this in jQuery, someone more experienced than I may be able
to help with.

On Feb 13, 11:28 am, roryreiff  wrote:
> Hi there,
>
> I am using the Validation plugin to validate a form that emails the
> current pages URL to the recipients entered in to the "email to"
> field. I want to validate that field for multiple emails addressed
> separated by commas...and ideas on how to do this? I'm a bit new to
> jQuery so I am a little confused how to approach this. I was thinking
> somehow altering the email function so that is parses the input and
> does a for each on every email address. Is this correct thinking? Is
> there an easier way to do this?
>
> Thanks,