Overview:
I need to compare values entered into a form against database values
to check for any type of duplicate text. I setup a javascript
function to take the value of my text boxes and remove any non-text
characters ie. /\W/ and set the value of a hidden field to the
returned string.
My plan is to compare the hidden field values to the database values
using vbscript whereby I set up an array that stores the database
records and then processes them through another function to remove
non-text characters.
Problem:
When I try to execute the vbscript function and pass the array data to
it, the page returns a returns a "type mismatch" error. I tried
setting the array value to a variable in this version of the code but
it doesn't seem to make any difference.
Thanks in advance!
-----The vbscript-----
'Replaces non-text
dim objRegExpr
Function stringMatchVB(strValue)
Set objRegExpr = New RegExp
objRegExpr.Pattern = "\W"
objRegExpr.Global = True
objRegExpr.IgnoreCase = True
stringMatchVB = objRegExpr.Replace(strValue, "")
Set objRegExpr = Nothing
End Function
dim dbTextArray()
dim arTable
dim tCols, tRows
dim tmpString
dim x, y, z
if vEOF="true" then
'Enter table values into an array
arTable = adoRS.GetRows()
adoRS.Close
'Find the number of records returned
tCols = UBound(arTable, 1)
tRows = UBound(arTable, 2)
'Array loop to search for matching values
For x = 0 to tRows
response.write("<br>")
For y = 1 to tCols
z = 0
REDIM PRESERVE dbTextArray(z, x)
tmpString = artable(y, x)
dbTextArray(z, x) = stringMatchVB(tmpString)
response.write(dbTextArray(z, x))
'response.write(artable(y, x))
response.write(" ")
'if arTable(y,x) = adoRS("SurveyQuestionID") then
'end if
z = z + 1
Next
Next
end if