Forum Moderators: open

Message Too Old, No Replies

Date and time verification

after user enters it

         

kkonline

3:55 am on Nov 25, 2007 (gmt 0)

10+ Year Member



I wan to write a javascript which accepts a date from user and verifies that its correct

Fotiman

4:30 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



1. "accepts a date from user"
How do you want to collect the date? Via an input element? Or via a prompt()? Or via a calendar? (If I recall correctly, you might run into problems with prompt() in IE7).

2. "verifies that its correct"
What does it mean to be "correct"?

I would recommend using a calendar. There are many examples of JavaScript date pickers on the web. Here's the one that comes with the Yahoo UI Library:
[developer.yahoo.com...]

d40sithui

10:27 pm on Nov 26, 2007 (gmt 0)

10+ Year Member



as fotiman pointed out, theres a whole bunch of premade calendar things in js out there. if you want to write one, go for it. basically all it does is provide a popup for you to select a day. after that, that date will go into a input. js calendars usually will already have "correct" dates, meaning a legit day not November 32 2007 or something like that. you can further verify in php with the check_date() command. im sure cgi, asp, jsp, etc will have equivalent functions.