MacD Level: Big Cheese
 Registered: 06-01-2004 Posts: 19
|
Re: Javascript date validation ?
Hi,
If you are using ASP.NET for developing your application then try to use the regular expression validator control available in ASP.NET.
Set the control to validate property to the name of the textbox that will be containing your date and in your validation expression copy and paste the regular expression below:
(([1-9]|[1-2][0-9]|3[0-1]|0[1-9])[/ /.]([1-9]|1[0-2]|0[1-9])[/ /.]([1-9][0-9])\d\d)|(([1-9]|[1-2][0-9]|3[0-1]|0[1-9])[- /.](0[1-9]|1[0-2]|[1-9])[- /.]([1-9][0-9])\d\d)
It support dates in the format dd/mm/yyyy or dd-mm-yyyy
You can also improve it. I hope this will help you that is if you are using ASP.NET
regards,
____________________________
MacD
|