lucene83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-30 23:46 UTC
How to validating email with Ajax and Prototype Library?
How to validating email with Ajax and Prototype Library? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Brian Williams
2007-Jul-01 00:02 UTC
Re: How to validating email with Ajax and Prototype Library?
validate email to what end? that it is a valid email format or validate it to activate a new account? On 6/30/07, lucene83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <lucene83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > How to validating email with Ajax and Prototype Library? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Diodeus
2007-Jul-03 18:17 UTC
Re: How to validating email with Ajax and Prototype Library?
I do it with this plain-old Javascript: var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org| edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/ if(!emailRe.test(document.F1.email.value)) { alert("Bad Email") } On Jun 30, 7:46 pm, "lucen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <lucen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How to validating email with Ajax and Prototype Library?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Tom Gregory
2007-Jul-03 21:33 UTC
Re: How to validating email with Ajax and Prototype Library?
It''s a) fragile (every time a tld is added, you''ve got to go change your regex) b) allows invalid addresses (underscores in the domain name), and c) excludes valid email addresses (e.g. the ''+'' character in the local part of the address is legal). As another example, you left out .asia, .biz, .jobs (apple must love this one!), .mobi, .... http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains If you *must* validate in javascript, you''re better off with a looser script. The only solid way of validating is to send the user an email, and have them respond (click a link, etc.) TAG See also: en.wikipedia.org/wiki/E-mail_address http://uphpu.org/pipermail/uphpu/2005-December/004221.html On Jul 3, 2007, at 12:17 PM, Diodeus wrote:> > I do it with this plain-old Javascript: > > var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org| > edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/ > if(!emailRe.test(document.F1.email.value)) { > alert("Bad Email") > } > > > On Jun 30, 7:46 pm, "lucen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <lucen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> How to validating email with Ajax and Prototype Library? > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Diodeus
2007-Jul-04 02:26 UTC
Re: How to validating email with Ajax and Prototype Library?
That''s ok. I didn''t write it and those are flaws I can live with. On Jul 3, 5:33 pm, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote:> It''s a) fragile (every time a tld is added, you''ve got to go change > your regex) b) allows invalid addresses (underscores in the domain > name), and c) excludes valid email addresses (e.g. the ''+'' character > in the local part of the address is legal). > > As another example, you left out .asia, .biz, .jobs (apple must love > this one!), .mobi, ....http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains > > If you *must* validate in javascript, you''re better off with a looser > script. The only solid way of validating is to send the user an > email, and have them respond (click a link, etc.) > > TAG > > See also: > en.wikipedia.org/wiki/E-mail_addresshttp://uphpu.org/pipermail/uphpu/2005-December/004221.html > > On Jul 3, 2007, at 12:17 PM, Diodeus wrote: > > > > > I do it with this plain-old Javascript: > > > var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org| > > edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/ > > if(!emailRe.test(document.F1.email.value)) { > > alert("Bad Email") > > } > > > On Jun 30, 7:46 pm, "lucen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <lucen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> How to validating email with Ajax and Prototype Library?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 4, 12:26 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jul 3, 5:33 pm, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote: > > > It''s a) fragile (every time a tld is added, you''ve got to go change > > your regex) b) allows invalid addresses (underscores in the domain > > name), and c) excludes valid email addresses (e.g. the ''+'' character > > in the local part of the address is legal). > > > As another example, you left out .asia, .biz, .jobs (apple must love > > this one!), .mobi, ....http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains > > > If you *must* validate in javascript, you''re better off with a looser > > script. The only solid way of validating is to send the user an > > email, and have them respond (click a link, etc.) > > > See also: > >en.wikipedia.org/wiki/E-mail_address > ><URL: http://uphpu.org/pipermail/uphpu/2005-December/004221.html > > > That''s ok. I didn''t write it and those are flaws I can live with.When posting someone else''s code, you should get their permission or if has been published somewhere, reference the source. You should also indicate the shortcomings when you suggest to someone else that they use it. -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
jdalton
2007-Jul-06 04:17 UTC
Re: How to validating email with Ajax and Prototype Library?
Ya, lets gang up on Diodeus for trying to help someone, maybe he won''t next time... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 6, 2:17 pm, jdalton <jdalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ya, lets gang up on Diodeus for trying to help someone, maybe he won''t > next time...It''s not a matter of ganging up on anyone. If Diodeus hadn''t posted the code then its shortcomings would not have been pointed out. And if the code had remained in this group''s archives without comment, someone searching for "email validation" may well have adopted it without realising its flaws. Knowing whether Diodeus is the author or the code has been published helps to determine whether it was intended it to be used as a general email checking script and who to contact for permission to use it. If anyone posts code that they didn''t write, they should *always* state where it came from. The fact that something someone posted is criticised should not be seen as negative, neither Tom nor I said anything harsh. The main benefit of a public group is that anyone can review and comment on anything that is posted here - hopefully constructive criticism outweighs negative. Perhaps I should include plenty of smilies :-) when providing advice next time. ;-) -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Tom Gregory
2007-Jul-06 15:51 UTC
Re: How to validating email with Ajax and Prototype Library?
I''ve got to agree with Rob on this one. I appreciate the concern for other group members. It keeps all of us honest, and polite. I can be a bit abrasive at times, especially via email. It''s usually not intended. (Unless I''m responding to someone who a) hasn''t read the archives from even the previous _day_, and b) clearly didn''t bother to use Google before asking an oft-repeated question.) Part of the trouble with an email validation regex is a) it''s a common request on the internet, b) every body has their own version, and c) hardly anyone gets it right. It is IMHO, in most cases, the wrong way to solve a particular problem. The principles at work here are: 1. Code should attempt to be timeless. A programmer should write code believing it will be in use in a couple hundred years (without needing to be fixed). 2. When validating, accepting "bad" data is usually preferable to rejecting "good" data. More comments inline, below. On Jul 6, 2007, at 1:22 AM, RobG wrote:> Knowing whether ... is the author or the code has been published > helps to determine whether it was intended it to be used as a general > email checking script and who to contact for permission to use it. If > anyone posts code that they didn''t write, they should *always* state > where it came from.Yes, but I think there''s an implicit understanding (correct or not) that small posted snippets are for general use.> The fact that something someone posted is criticised should not be > seen as negative, neither Tom nor I said anything harsh. The main > benefit of a public group is that anyone can review and comment on > anything that is posted here - hopefully constructive criticism > outweighs negative.I''ve posted code/ideas several times, only to have the idea "improved" (read: corrected) by some of the exceptional programmers here. One of the reasons I like participating is the number of exceptionally smart people that regularly contribute. One of the ways I learn is to identify the flaws in my code/methods. People here help with that (politely), and I appreciate it.> Perhaps I should include plenty of smilies :-) when providing advice > next time. ;-)<chuckle> TAG --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---