MoMo
07-31-2002, 05:20 PM
Hello,
I was wondering if there was a way to quickly check if a submitted form field had anything other than letter/numbers in it. By using the following statement, I can check for each special character, but that would require a seperate test for each special character or symbol. I can also use a case statement.....but is there a faster way than using nested IF's or long case statements?
Here's an example of what I mean:
Dim Form_Field
Form_Field = Request("Form_Field")
If InStr(Form_Field,"@")=1 Then
'invalid input
ElseIf InStr(Form_Field,"!")=1 Then
'invalid input
ElseIf InStr(Form_Email,"#")=1 Then
'invalid input
....and so on, for each non number/letter.
End If
I guess what i'm asking is if there is a way to parse the entire string at once and detect anything that isn't a letter or number, then redirect them with an error message..?
Thanks in advance for any help.
I was wondering if there was a way to quickly check if a submitted form field had anything other than letter/numbers in it. By using the following statement, I can check for each special character, but that would require a seperate test for each special character or symbol. I can also use a case statement.....but is there a faster way than using nested IF's or long case statements?
Here's an example of what I mean:
Dim Form_Field
Form_Field = Request("Form_Field")
If InStr(Form_Field,"@")=1 Then
'invalid input
ElseIf InStr(Form_Field,"!")=1 Then
'invalid input
ElseIf InStr(Form_Email,"#")=1 Then
'invalid input
....and so on, for each non number/letter.
End If
I guess what i'm asking is if there is a way to parse the entire string at once and detect anything that isn't a letter or number, then redirect them with an error message..?
Thanks in advance for any help.