CF comes with a fairly good Javascript date validation routine that can be
tweaked quite easily (I think it's created when you use CFFORM).  Mail me
off list if you want a copy - we've changed it a bit so it's more robust and
can take . or / as date separators.

Karl.


Karl O'Sullivan
Senior Analyst Programmer
University Hospitals Coventry and Warwickshire NHS Trust
Tel: 024 7660 2020 x7578
[EMAIL PROTECTED]

> ----------
> From:         Aidan Whitehall[SMTP:[EMAIL PROTECTED]]
> Sent:         24 January 2003 14:03
> To:   [EMAIL PROTECTED]
> Subject:      [ cf-dev ] OT: JavaScript date validation
> 
> Posted this to JS-Jive, but it's a really quiet list and no
> takers so far. Anyone know how to do this? Thanks.
> ==================================
> 
> We need to be able to validate that someone's entered a valid future
> date in an HTML text box in the format 'dd/mm/yyyy' (UK here), where the
> day and month can either be optionally padded with zeroes. I would
> rather learn how to do this than use one of the canned scripts available
> on the web.
> 
> Is the best way to go about this
>  - double-check to see that there are two '/'s
>  - ensure that the values between the '/'s are numeric
>  - try to create a date object using the values
>  - catch any errors ?
>  - check to see that the date is greater than Now()
> 
> I'd be ok with the first two steps, but am unsure how to go from there.
> ColdFusion has try/catch error handling... is there an equivalent in
> JavaScript? And if so, is that the best way to do this in JS?
> 
> Thanks for any help you can offer.
> 
> 
> -- 
> Aidan Whitehall <[EMAIL PROTECTED]>
> Macromedia ColdFusion Developer
> Fairbanks Environmental Ltd  +44 (0)1695 51775
> 
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 

-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to