Classic ASP: I'm getting a type mismatch error when I shouldn't -


i have function turning html encoded text html. works great normally, reason, try use on text today, , following error:

microsoft vbscript runtime error '800a000d'  type mismatch: 'unchkstring'  /manage/solutions_delete.asp, line 22 

the line using function on is:

<%= unchkstring(solution_desc) %> 

the solution_desc variable is:

&lt;p&gt;here description of solution about.&lt;/p&gt; 

the field database pulling solution_desc text field.

my unchkstring function is:

function unchkstring(string)     unchkstring = replace(string,"[%]","%")     unchkstring = htmldecode(unchkstring) end function 

the htmldecode function is:

function htmldecode(stext)     dim     stext = replace(stext, "&amp;" , chr(38))     stext = replace(stext, "&amp;" , "&")     stext = replace(stext, "&quot;", chr(34))     stext = replace(stext, "&rsquo;", chr(39))     stext = replace(stext, "&lt;"  , chr(60))     stext = replace(stext, "&gt;"  , chr(62))     stext = replace(stext, "&nbsp;", chr(32))     = 1 255         stext = replace(stext, "&#" & & ";", chr(i))     next     htmldecode = stext end function 

edit

i've tried:

<%= unchkstring(cstr(solution_desc)) %> 

with no luck.

sometimes best re-read error carefully. consider chunk of vbs:

 dostuff("hello world") 

since dostuff not defined nor there option explicit get:

error: type mismatch: 'dostuff'

your error is: type mismatch: 'unchkstring'. not complaining parameter being passed complaining unchkstring itself. guess have committed basic of vbscript programmming goofs, don't have option explicit @ top of code. must.

for reasons unclear form code posted far code @ point <%= unchkstring(solution_desc) %> being executed script engine not have function unchkstring, hence error seeing. suspect inclusion of option explicit reveal problem (as forcing dim variables).


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -