In comp.lang.javascript message <5jlaviF5h00U1@mid.individual.net>, Wed,
29 Aug 2007 14:34:41, Mick Walker <materialised@privacy.netposted:
Quote:
>At the moment I am using 3 different function, one to validate the
>date,
You are attempting a remarkably complex RegExp-only method. See,
without delay, <URL:http://www.merlyn.demon.co.uk/js-date4.htm>, for
validating a string as a date and reading it. Then check the age by
comparison of as many of Y M D as is necessary, after checking the exact
applicable definition of 18.
Quote:
one to validate the email,
Don't get carried away : see, likewise,
<URL:http://www.merlyn.demon.co.uk/js-valid.htm>.
Quote:
and another to make sure all elements contain a value.
Literally meaningless - all input controls always have a string value.
You can check that the string is non-empty or non-visibly-blank or long
enough or has only the right sort of characters or ...
Quote:
var errorMessage = 'Please enter valid date as month, day, and four
>digit year.\nYou may use a slash, hyphen or period to separate the
>values.\nThe date must be a real date. 30/2/2000 would not be
>accepted.\nFormat dd/mm/yyyy.';
Confusing. Is the error that February rarely has a 30th or that 2 is a
single character or both? OTOH, you might as well allow any non-digit
separator, matching with /\s*(\d\d?)\D+(\d\d?)\D+(\d\d\d\d)\s*/ or
similar.
Quote:
>I hope someone can help
Your firm's best move is to hire a javascript programmer if javascript
is to be programmed; also, seek a Thunderbird spelling-checker.
It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.