473,320 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Entering dates

Hi all,

What is an elegant way of allowing a user to enter a date into a web form?
I'd like the date to be entered in dd/MM/yyyy format and validated on the
client as well.

Regards
John.
Nov 18 '05 #1
3 1417
http://www.peterblum.com/DateControls/Home.aspx

Greg

"John" <a@b.com> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
Hi all,

What is an elegant way of allowing a user to enter a date into a web form?
I'd like the date to be entered in dd/MM/yyyy format and validated on the
client as well.

Regards
John.

Nov 18 '05 #2
"John" <a@b.com> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
Hi all,

What is an elegant way of allowing a user to enter a date into a web form?
I'd like the date to be entered in dd/MM/yyyy format and validated on the
client as well.

Regards
John.


Use a regular expression validator with
"(0?[1-9]|[1-2][0-9]|30|31)/(1[0-2]|0?[1-9])/[0-9][0-9][0-9][0-9](.)*" as
the validation Expression (this however will accept 31/2/9999 as a valid
date. Feel free to tighten it up if you want). I believe it will be
validated clientside.

If you want to be really picky, write a custom validator in JScript (just
remember to do a stricter check on the server side as well as not all
browsers will run JScript).
--
Brian Barnes
No Spam Proof e-mail
Use News Groups
Nov 18 '05 #3
Microsoft has provided the CompareValidator to check dates. Set its Operator
property to DataTypeCheck and Type property to Date.
It follows the current culture of the page to determine the
ShortDatePattern. For example, if you are in the UK, you can set <%@ Page
culture='en-UK' %>.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Brian Barnes" <sp****@nospam.com> wrote in message
news:OQ**************@TK2MSFTNGP09.phx.gbl...
"John" <a@b.com> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
Hi all,

What is an elegant way of allowing a user to enter a date into a web
form?
I'd like the date to be entered in dd/MM/yyyy format and validated on the
client as well.

Regards
John.


Use a regular expression validator with
"(0?[1-9]|[1-2][0-9]|30|31)/(1[0-2]|0?[1-9])/[0-9][0-9][0-9][0-9](.)*" as
the validation Expression (this however will accept 31/2/9999 as a valid
date. Feel free to tighten it up if you want). I believe it will be
validated clientside.

If you want to be really picky, write a custom validator in JScript (just
remember to do a stricter check on the server side as well as not all
browsers will run JScript).
--
Brian Barnes
No Spam Proof e-mail
Use News Groups

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Colin Steadman | last post by:
I'm a stupid ASP programmer and I dont do Javascript (except for very simple tasks anyway), and I'm in a bit of a predicament. I've used a javascript table sorting script from here: ...
5
by: Paul | last post by:
Hi This has taken me ages to work out but i'm sure there is a simple explanation and somebody here will be able to help. I'll talk you through it as best i can: 1. User enters dates on an...
3
by: Beacher | last post by:
Please, any help is GREATLY appreciated. I need to have SQL Server 2000 Check a field (EffectiveDate) to make sure the date is any date in the future past today. I've gotten as far as the 'Manage...
12
by: Dixie | last post by:
I am trying to calculate the number of workdays between two dates with regards to holidays as well. I have used Arvin Meyer's code on the Access Web, but as I am in Australia and my date format is...
1
by: pitfour.ferguson | last post by:
My dbase has the start date and end date of each visit. How can I ask Access to list the day of the week of the start (easy), end (easy) and, more importantly, the dates of the visit itself - ie...
1
by: josecruz | last post by:
I have to create a summary report that will provide counts and # average of days for multiple "Status" by entering different dates for every criteria. I have created several queries that calculates...
3
by: Tom | last post by:
Being a newbie to JS, I would appreciate some advice. When a visitor enters a number into a textbox, I want to check that it is 15 digits long and then display a message accordingly and the...
3
by: CB Cemetery | last post by:
Hello, I am a student who has developed at database for the Pioneer Cemetery that adjoins our school. I am very inexperienced with Access. I use an input mask to add burial dates mm/dd/yyyy. The...
2
by: Jim Carlock | last post by:
(1) Does PHP provide any way to handle dates prior to 1980? I know there's problems with Microsoft Windows NT and all Windows NT operating systems will allow a date prior to 1980 to be placed...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.