Gossamer Forum
Home : General : Internet Technologies :

Javascript: validate a date field?

Quote Reply
Javascript: validate a date field?
Hi. I know its possible to do date validating via PHP/Perl, but I would rather do this with Javascritp. Does anyone know how I could check the validity of a date field, in the format of;

03-02-2005

TIA.

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Javascript: validate a date field? In reply to
I'm sure Google knows the answer ...

http://www.google.com/...e=UTF-8&oe=UTF-8

Interesting results:

http://www.google.com/...1623.html&e=7385

http://javascript.internet.com/...s/validate-date.html

- wil
Quote Reply
Re: [Wil] Javascript: validate a date field? In reply to
Ah... didn't see them. I did a search on google, but the results used some *really* complex javascript... withabout 5 routines,and loads of stuff I didn't understand...To top it all off, it wasn't in the right format either Wink I'll have a play with the 2nd link you provided. It looks like it will work a charm :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Javascript: validate a date field? In reply to
Check out the one Wil mentioned on javascript.internet.com it will let you set the format in several different ways. The one attached below comes from the same place but uses slashes "/" between the dates and does the formatting as you type - I've used it a lot, it really cool.
Quote Reply
Re: [Watts] Javascript: validate a date field? In reply to
Thanks.

I ended up just writing a bit of simple code myself... with some regex...

like;

^(01|02|03|04|05|06|07|08|09|10..etc|)\-(01|02|03|04|05|06|07|08|09|10|11|12|)\-(2003|2004|2005|2006|2007)$

Seems to be working ok Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates