Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Input Mask" for Date field in form

Status
Not open for further replies.

itsuit

IS-IT--Management
Apr 23, 2002
53
US
I have a form with 2 date fields (Start and End dates). I'd like to allow the user to just type in the numbers without having to remember the "/" between. I know I've seen this done, but can't find an example now and it's driving me crazy.

Any suggestions?

Kyle
 
Best way to do it is to get people to do it in yyyymmdd format.

April 16th 2003 would be 20030416 - the other advantage of this is that today is numerically higher than yesterday and also, it is trivial to parse the date.

Given the number of different ways a date can be entered, alternatives you may get are

16042003 (Euro style)
04162003 (US Style)
1642003 Will they put in leading "0"s?
41603

If only we could stop people actually using our applications, creating them would be so much easier. :eek:)

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
I'm sorry, I didn't spell out clearly what I'm looking for (although Microbe's idea does make sense, it's not what my boss wants).

What I'm looking for is something similar to an Input Mask in Access, where the field is basically pre-formatted to accept a date entry, so that as the user enters the numbers, the slash ("/") automatically appears after the first two digits, then again after the second two.

If I'm still not explaining this correctly, please let me know.

Thanks in advance.

Kyle
 
you'll need to incorpurate client scripting in the form to obtain this functionality. javascript prbably will be the simple solution with a onKeyUp event or down. when you write your script just check some values on the event
1) length to know when to place the / in there
2) is it a number isNaN function
3) is it a valid month,day,year value
4) is it in the past present or future

this shouldn't be a difficult script to write. when you get it going if any problems arrise the javascript or vbscript forum depending on what you use should be the place to find help.
forum216 and forum329

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top