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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rules for date field.

Status
Not open for further replies.

Jahappz

Technical User
Jun 3, 2002
133
SE
I have this asp page where i want the users to enter a date:
my problem is that the users can write "2004 July 01"
"Juli 01 2004" i want to limit that to only "2004-07-01"
so that they have to write it like that.
 
split it into 3 select boxes! and concatenate it back together.

otherwise you will have an impossible task trying to validate for every language, mis-spelling, typo, sheer stupidity etc.



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
or you can create a pop up calender and force the user select the date from it which populated the input field in the format you want...

-VJ
 
Or similar to both the above, you dould just force the user to select from three dropdowns. This givs you the simplicity of Chris's solution mixed with the even smaller need for validation from amorous's post without any extra objects. Or in English, you limit the user to only correct answers because they can't type anything in, but you don'thave to worry about them supporting anything client-side because you are using simple select tags.

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
thats all good idéas but the years is like 1997 and up...
makes a calendar pretty annoying to choose from...

isnt there a way to force the input of a text field / or somting to be like _ _ _ _ - _ _ - _ _ (1996-03-23)
 
in that case just use some java validation, force numbers only, and you can even capture on keypress for all items only, and alert an error if they try to type J for july.

plain english label out the entry format as in :

please enter your birthdate, format only as YYYY-MM-DD ( 1969-07-04 )


[thumbsup2]DreX
aKa - Robert
 
use a combination. select boxes for month and date, text box for the year. then you only need to check for numerics and the appropriate digit count (just one Reg Ex)



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top