| lazeez on Jan 30, 2004 at 3:56:26 AM | No Rating |
|
Dear Friends
We are an Egyptian company that works in the distribution of ringtones and logos. We would like to cooperate with you in getting the know-how for sending Polyphonic ringtones and MMS. Please note that the two local GSM networks are WAP enabled.
We are counting on you support to introduce that service to Egypt.
Thank You
Mohamed El Naggar
Cairo-Egypt
Mobile +20 12 7430020 |
| ToddK on Dec 31, 2003 at 10:47:51 AM | Rating: 5 |
Great Article. I went from not knowing a thing, to validating US and Canadian zipcodes, phone numbers, etc in about 30 minutes. Will kepp this bookmarked! |
| lardeb on Jan 30, 2003 at 3:37:19 PM | Rating: 5 |
Yes...this is really good. A lot easier than looping thru a text value and comparing characters against an acceptable string. Thanks Karen for taking the time to setup these examples.
Larry |
| cgisackson on Feb 26, 2002 at 7:23:03 AM | Rating: 5 |
| Excellent code sample with lots of utility. |
| marisl on Feb 25, 2002 at 7:26:39 AM | No Rating |
| Will this method of validation support international character sets. And if it won't, what are your recommendations? |
| kgayda on Feb 22, 2002 at 6:41:08 PM | No Rating |
| EblingMis: The script didn't fail, it was coded to restrict the dates to be entered in that format. I believe comments in the code stated that if I recall. The samples were just simple examples for tutorial purposes. They were meant to be modified to suit whatever needs the user has in his/her particular environment. |
| ABOWES on Feb 12, 2002 at 4:28:47 AM | Rating: 5 |
Superb article. Saved me a lot of effort to generate a function to check for valid 24 hour time formats. |
| EblingMis on Jan 16, 2002 at 3:00:04 PM | No Rating |
| Note: In my last posting the lines to be corrected were lines lines 36-44 of the validUSDate function. This makes them lines 268-276 of the RegExpValidate.js file. |
| EblingMis on Jan 16, 2002 at 2:49:44 PM | Rating: 4 |
This script fails on dates like 1/30/2002. You are forced to use a leading zero for the month as in 01/30/2002.
The problem lies in lines 37-45. You use arrayDate[0] to check of the month and day values agree. If you want to allow users to omit the leading zero when the day value is greater than 28 (or 29 for leap year) you should modify these lines as follows:
//create a lookup for months not equal to Feb. var arrayLookup = { '1' : 31,'3' : 31, '4' : 30,'5' : 31,'6' : 30,'7' : 31, '8' : 31,'9' : 30,'10' : 31,'11' : 30,'12' : 31} //check if month value and day value agree if(arrayLookup[intMonth] != null) { if(intDay <= arrayLookup[intMonth] && intDay != 0) return true; //found in lookup table, good date } |
| pprovost on Aug 17, 2001 at 8:52:27 AM | Rating: 5 |
Kubis posted a comment indicating that email validation passes on some weird cases. (e.g. a@a....com, or a@.com). To solve this, you can replace the regular expression in validateEmail() with the following:
var objRegExp = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-]+)(\.[a-z0-9_\-]+)+$/i; |
| mama_amarillo on Jun 14, 2001 at 11:36:54 AM | Rating: 5 |
| Great. Very clear explanation of those cryptic-looking symbol strings. |
| Kubis on Aug 8, 2000 at 7:47:59 AM | No Rating |
I think this one is little bit buggy.. i have tried the e-mail like somthing@somewhere....com and it seemd to be okay ...
also at something@.something.com seems okay to the script... |
| dman_ag on Jul 4, 2000 at 2:11:46 AM | Rating: 5 |
| cool |
| vela-x on Jun 9, 2000 at 2:45:18 PM | No Rating |
| I just figured it out! You just need to specify the "radix" parameter as base 10. The javascript bible says "The primary problem comes when a string parameter for parseInt() starts with a zero...In javascript, numbers starting with zero are treated as octal (base 8) numbers....When you apply the parseInt() function, you should always specify the radix of 10 if you are working in base 10 numbers." I'm sure that's what caused the problem I mentioned below (08 being treated as 0, and then failing the date validation..makes total sense now). |
| vela-x on Jun 9, 2000 at 2:31:20 PM | Rating: 4 |
| Good article and examples. However, it looks like there may be a bug with the date validation. Try any date with "08" or "09" in the day slot (like "06/08/2000"). I'm using IE5 and every time it fails the validation. I debugged it to a point; it looks like it splits the array ok, but after parseInt it reads the day as "0". It's very strange because "02", "03", etc. work fine. I haven't tried it in any other browser version. I found a good date validation example here: http://javascript.internet.com/forms/val-date.html which doesn't use parseInt and doesn't have this problem. |
| Vesna on Jun 6, 2000 at 6:49:11 AM | No Rating |
A listing of Country Code Top-Level Domains (CCTLDs) can be found at http://www.iana.org/cctld/cctld.htm. IANA is the Internet Assigned Numbers Authority.
Hope this helps! |
| kgayda on Jun 5, 2000 at 7:16:41 AM | No Rating |
nadtech,
The problem with the email expression was an oversite but I am aware of it and have since rewritten it. I will post a but fix to address the issue. As far as a domain name spec, I had found one by searching www.w3c.org. It is a very stimulating document. I don't have the exact article URL at the moment but if you are unable to locate it I will dig it out of my archives and get it for you. |
| MJohn on Jun 5, 2000 at 5:12:45 AM | Rating: 5 |
Good article.
|
| danielvogel on Jun 3, 2000 at 1:37:05 PM | Rating: 5 |
Great Article!
One caveat is that the email validation rouitine is too restrictive. It would improperly declare addresses like name@server.ca , 1234@server.com or name@1234.com as invalid. But, using the excellent information in the article, I was able to expand on the Email Validation Reg Expression and created a more versitile one. It even checks that the standard 3 letter top level domain is valid.
Here it is:
/(^([a-z0-9\_\.]*)@([a-z0-9])|([a-z0-9]([a-z0-9\-\.]*))((\.com)|(\.org)|(\.net)|(\.mil)|(\.gov)|(\.edu)|(\.[a-z]{2}))$)/i
It's still far from perfect. For example, it would consider ..____...@d..-----.....com a valid email address! (But would properly allow something like first.last_work@email.big-company.com .)
Also: Does anyone know where a definitive description of valid domain names and valid email address exists? |
| kgayda on May 30, 2000 at 5:41:43 PM | No Rating |
I have tested the code with Netscape 4.73 and cannot reproduce the error that Mike describes. The line window.onload = new Function("userInput.field.focus()") was not in my original source that is downloadable but was changed when formatted by this site. Regardless, I cannot duplicate the problem and would be interested if anyone else is experiencing the same thing as Mike. |
| _mike_ on May 30, 2000 at 12:32:57 PM | Rating: 3 |
Content is good but the coding is flawed. You say "Cross-Browser Form Validation" but you get a javascript error as soon as the page loads (Netscape 4.73):
"userInput is not defined."
Probably need to change:
window.onload = new Function("userInput.field.focus()")
to:
window.onload = new Function("document.userInput.field.focus()");
|
| nadtech on May 8, 2000 at 2:21:28 PM | Rating: 5 |
| Excellent job!!!!!!!!! |
| jfmorley on Apr 18, 2000 at 10:51:47 AM | Rating: 5 |
| THANK YOU! This is a really excellent article. Clear explanations and examples and it includes all the basic reference information. Wish I'd had it a few months ago when trying to figure out expressions for validation and formatting myself. |
| flachance on Apr 18, 2000 at 7:23:33 AM | Rating: 5 |
Good Job!
The best article that I've seen yet on regular expressions. I especially like the sample page with the most common validation jobs in it. This one is making the top of my bookmarks on regexp reference.
Good job! |
| adsmart on Apr 18, 2000 at 7:14:09 AM | Rating: 5 |
This is an excellent resource. I have been doing the same thing for a while now and its nice to see others doing it. Its also nice to have some extra functions to work with.
One thing. The regexp for the Email is a little flawed. var objRegExp = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
excludes alot of email addresses since it does not allow numbers. The regexp I use is: var regEmail = /^[A-Za-z0-9\-_]+(\.[A-Za-z0-9\-_]+)*@([A-Za-z0-9\-_\.]+\.)+[A-Za-z]{2,3}$/i;
This has a few advatages... first, it allows numbers and other characters. Second it forces the text into the Host.Domain format. I enforce the same requirements for the name part but that is a trivial thing. |