Moron Posted September 8, 2006 Share Posted September 8, 2006 In my search for this, I've found scripts that will validate [i]either[/i] date or time input formats, but not both in the same script.Anybody seen one like this? Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 8, 2006 Share Posted September 8, 2006 Users like to enter dates in so many different formats that I've always found the best solution to date/time entry is to give them a 'date picker' that places their selection into a text box on the form. If they then decide to fool around with what's in the text box, they get what they deserve. Meanwhile, users with IQs higher than room temperature will appreciate the ease of data entry provided by a date picker.http://www.rainforestnet.com/datetimepicker.htm is excellent Quote Link to comment Share on other sites More sharing options...
Moron Posted September 9, 2006 Author Share Posted September 9, 2006 [quote author=AndyB link=topic=107380.msg430977#msg430977 date=1157758553]Users like to enter dates in so many different formats that I've always found the best solution to date/time entry is to give them a 'date picker' that places their selection into a text box on the form. If they then decide to fool around with what's in the text box, they get what they deserve. Meanwhile, users with IQs higher than room temperature will appreciate the ease of data entry provided by a date picker.http://www.rainforestnet.com/datetimepicker.htm is excellent[/quote]I'm already using a popup calendar date picker. It works great, but as you implied, it's just a matter of time before someone decides to enter it "manually" and gets it wrong. Right now there is NO validation on these fields except that they can't be left blank. You can enter anything, even a string like askdnvioweh as the date and it'll go as long as it's not blank. Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 9, 2006 Share Posted September 9, 2006 Is server-side validation an option? Quote Link to comment Share on other sites More sharing options...
Moron Posted September 9, 2006 Author Share Posted September 9, 2006 [quote author=AndyB link=topic=107380.msg431060#msg431060 date=1157772385]Is server-side validation an option?[/quote]Possibly, but I somehow thought that I could find the perfect Javascript for this in a matter of seconds. ;D Quote Link to comment Share on other sites More sharing options...
Moron Posted September 11, 2006 Author Share Posted September 11, 2006 Bump.Anybody seen a script like this? I'm finding everything BUT what I'm looking for.Some calculate date differences. Don't need that.Some allow standard or military time. Don't need military.Some validate everything under the sun INCLUDING what I'm looking for, but crash if I try to modify them.All I need is:[b]Start Date:[/b] Must be mm/dd/yyyy format.[b]Start Time:[/b] Must be hh:mm format. No military time, no GMT, no AM/PM.[b]End Date:[/b] Must be mm/dd/yyyy format.[b]End Time:[/b] Must be hh:mm format. No military time, no GMT, no AM/PM.[b]Total Hours:[/b] Can't be left blank.Anybody seen something similar without a bazillion features I don't need? Quote Link to comment Share on other sites More sharing options...
freakus_maximus Posted September 13, 2006 Share Posted September 13, 2006 I use a date picker also and they way I keep users from manipulating it is take make the INPUT field read only. Like this:[code]<INPUT id="date" style="WIDTH: 75px" type="text" name="date" value="" title="Year-Month-Day Format." readOnly>[/code]The date picker drops the selected value right in the box, but the user cannot make a change to it. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 20, 2006 Share Posted September 20, 2006 You can be lazy and use a simple regular expression to get the formatting right, though you'll have to validate the "date" as a date too (i.e. try and make a JS Date object from the component pieces). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.