Date Validation

I am using ASP forms to enter data into a database. One of the fields is a date field, and I am trying to validate the data being entered is a legal date entry.
yolishAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JagarConnect With a Mentor Commented:
Use the OnSubmit Event of the form that you are using to get the database information.  In that event check the Value of the Textbox that is surposed to hold the date.  You can check this by using the IsDate procedure of VBScript, ie.  If not IsDate(txtDate.Value) then alert "You must enter the date in this field."
If the person doesn't enter a date in the field then you can give them a msgbox and cancel the submission of the form.  Otherwise you can continue with the submission of the form.


Alternate method:  If there is a LostFocus Event for the control then you can check with the IsDate function at this point.
0
All Courses

From novice to tech pro — start learning today.