Hi...
I am creating this form validation process that allows to a time that is inputted by the user. Basically, I have this field that asks for a user to enter a time (format is specified as. Ex: "12:00 PM"). I want to make sure that the user types in a time with the appropriate format. After i completed my code, i keep receiving a type mismatch error. The error is specified on the line with the split function. Please help!..thx
Here is my code:
distTime = Request("time")
Dim strTimeArray(2)
strTimeArray = Split(distTime,": ")
if disTime <> "" Then
intTimeHour = CInt(strTimeArray(0))
intTimeMinutes = CInt(strTimeArray(1))
if intTimeHour < 0 OR intTimeHour > 12 Then
Response.Write "<center><b> The distribution time is not appropriate. Check the hours column</b></center>"
end if
if intTimeMinutes <0 OR intTimeMinutes > 59 Then
Response.Write "<center><b> The distribution time is not appropriate. Check the minutes column</b></center>"
end if
if strTimeArray(3) <> "AM" OR strTimeArray(3) <> "am" OR strTimeArray(3) <> "PM" OR strTimeArray(3) <> "pm" Then
Response.Write "<center><b> The distribution time is not appropriate. Check the AM/PM column</b></center>"
end if
end if
I am creating this form validation process that allows to a time that is inputted by the user. Basically, I have this field that asks for a user to enter a time (format is specified as. Ex: "12:00 PM"). I want to make sure that the user types in a time with the appropriate format. After i completed my code, i keep receiving a type mismatch error. The error is specified on the line with the split function. Please help!..thx
Here is my code:
distTime = Request("time")
Dim strTimeArray(2)
strTimeArray = Split(distTime,": ")
if disTime <> "" Then
intTimeHour = CInt(strTimeArray(0))
intTimeMinutes = CInt(strTimeArray(1))
if intTimeHour < 0 OR intTimeHour > 12 Then
Response.Write "<center><b> The distribution time is not appropriate. Check the hours column</b></center>"
end if
if intTimeMinutes <0 OR intTimeMinutes > 59 Then
Response.Write "<center><b> The distribution time is not appropriate. Check the minutes column</b></center>"
end if
if strTimeArray(3) <> "AM" OR strTimeArray(3) <> "am" OR strTimeArray(3) <> "PM" OR strTimeArray(3) <> "pm" Then
Response.Write "<center><b> The distribution time is not appropriate. Check the AM/PM column</b></center>"
end if
end if