...

View Full Version : Time Validation Help



bspahr
12-04-2006, 09:51 PM
I have 2 fields; start time and end time. Is there a way to validate that they enter the times in the correct format? Ex. 12:00

Here is the basic code:
Start Time: <input type="text" name="startTime"> (HH:MM format)
End Time: <input type="text" name="endTime"> (HH:MM format)


I found the link below which is kind of what I'm looking for, but it has alot of extra stuff that I don't need. I just want to validate the hour and minute.
http://javascript.internet.com/forms/val-time.html

Ancora
12-04-2006, 10:00 PM
I want, I want, I want....

mrhoo
12-04-2006, 10:46 PM
var rx= /^([1-9]|(11)|(12)) *\: *[0-5][0-9] *$/;
rx.test(startTime)

bspahr
12-04-2006, 11:27 PM
thanks mrhoo I will see if I can make that work. You want what Ancora?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum