Click to See Complete Forum and Search --> : Validate date
legolaz
02-17-2003, 12:29 PM
Hi
How do i validate a date in a form?
I have a pull down menu allowing users to select day, month and year. How do i check the date selected to ensure tat the date selected is after today's date?
Pls advise
tnks
Charles
02-17-2003, 12:31 PM
Please post the mark-up for the form that you are using.
legolaz
02-17-2003, 12:50 PM
http://66.246.35.222/~sprint/bookings.php
Charles
02-17-2003, 12:58 PM
if ((new Date (document.onlineBooking.booking_year.value, document.onlineBooking.booking_month.value, document.onlineBooking.booking_day.value) - new Date()) < 0) {alert ('Please enter a date in the future'); return false};
legolaz
02-17-2003, 01:16 PM
sorry but it doesnt work
it keeps saying tat the to enter a date in the future no matter wat date i try
Charles
02-17-2003, 02:10 PM
Sorry about that, I deleted some important stuff while debugging. This ought to do the trick.
if ((new Date (document.onlineBooking.booking_year.value, document.onlineBooking.booking_month.value, document.onlineBooking.booking_day.value).getTime() - new Date().getTime()) < 0) {alert ('Please enter a date in the future'); return false};
legolaz
02-17-2003, 02:32 PM
sob sob
still doesnt work
the same problem as per the last post.
legolaz
02-18-2003, 09:20 AM
Hihi
i got it to work by making some modifications to your code already
tnks a million for your help
cheers