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:
<p>here description of solution about.</p>
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, "&" , chr(38)) stext = replace(stext, "&" , "&") stext = replace(stext, """, chr(34)) stext = replace(stext, "’", chr(39)) stext = replace(stext, "<" , chr(60)) stext = replace(stext, ">" , chr(62)) stext = replace(stext, " ", 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
Post a Comment