Joined: Tue Mar 27, 2007 10:55 pm Posts: 2272 Location: Earth Has thanked: 39 time Have thanks: 61 time
Following code use isDate function to validate date inserted from user .
Code:
<form method ="post" action="<%= Request.ServerVariables("SCRIPT_NAME") %>"> Enter your birthday :<input type ="text" name="inputdate" size="40" id="inputdate "><br> <input type="submit" value="validate"> </form>
ASP script
Code:
<% Dim strDate, blnDateIsValid, createdDate If Request.ServerVariables("CONTENT_LENGTH") <> 0 Then strDate = Trim(Request.Form("inputdate")) ' use isDate function for validation If isDate(strDate) Then createdDate = CDate(strDate) ' date is valid blnDateIsValid = True Else ' invaild date. Response.Write(strDate & " is <b>invalid date</b>") End If
' valid date. If blnDateIsValid = True Then Response.Write(strDate & " is <b>valid date</b>") End If End If %>
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )