Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Wildcards

Status
Not open for further replies.

faiyth

Programmer
Nov 22, 2002
19
US
What I'm trying to do is validate an entry that a user types in. I'm trying to use wildcards but I'm not sure how. I want to make sure that no commas, double quotes, and single quotes are in the text entered by the user. My database statement can't handle those entries so I need to keep them out. How do I do it in VBScript in a ASP document?
Also I don't know how to check for Double quotes? What do I wrap around them to make them be seen as double quotes?


function validate()
bugtitle=Request.Form("Title")
bugdesc=Request.Form("Description")
bugbf=Request.Form("BuildFixed")
bugbr=Request.Form("BuildReported")
If bugtitle="*,*" OR bugtitle="*'*" OR bugdesc="*,*" OR bugdesc="*'*" OR bugbf="*,*" OR bugbf="*'*" OR bugbr="*,*" OR bugbr="*'*" Then
Response.Write "Please do not use any single quotes, double quotes or comma characters in your bug report. Thanks!"
End If
End Function
 
faiyth,

You need to test using instr function.

' Test for single quote
If instr(teststring, chr(39)) > 0 then
' Test for double quote
Elseif instr(teststring, chr(34))> 0 then
' Test for comma
Elseif instr(teststring, ",") > 0 then

End if

fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top