Click to See Complete Forum and Search --> : text area problems


jkruer01
01-12-2004, 02:56 PM
Hello,

I am trying to put the value of a field into a text area and I get the following error in the textarea:

<font face="Arial" size=2>
<p>Microsoft VBScript runtime </font> <font face="Arial" size=2>error '800a000d'</font>
<p>
<font face="Arial" size=2>Type mismatch: 'HTMLEncode'</font>
<p>
<font face="Arial" size=2>/changeContact.asp</font><font face="Arial" size=2>, line 192</font>

Below is what my code says:
<span class="bold">Notes:</span>
Is this comment <span class="urgent">URGENT</span>? Yes<input type="radio" name="urgent"
<%
if edit=1 then
if rs("Urgent")="Y" then
%>
checked
<%
end if
end if
%> value="Y" /> No<input type="radio" name="urgent" value="N"
<%
if edit=1 then
if rs("Urgent") <> "Y" then
%>
checked
<%
end if
else
%>
checked
<%
end if
%> /><br />
<span class="subInfo">
<textarea name="Notes" cols=75 rows=6><%
if edit=1 then
if rs("Notes")<>"" then
Response.Write( Server.HTMLEncode(rs("Notes")) )
end if
end if
%></textarea>
</span>

Does anyone have any suggestions as to why I am getting this error?

I would really appreciate some help.

THanks.

jkruer01
01-12-2004, 03:02 PM
More information...

If I use the following code it works. The only difference is I store the results in a variable before I display them. Why does it matter?

<textarea name="Notes" cols=75 rows=6><%
temp=rs("Notes")
if edit=1 then
if temp<>"" then
Response.Write( Server.HTMLEncode(temp) )
end if
end if
%></textarea>

CardboardHammer
01-12-2004, 04:09 PM
Why even use HTMLEncode? It's just going in a textbox, so it can be a string of whatever anyway.

CardboardHammer
01-12-2004, 04:19 PM
Perhaps

Response.Write(Server.HTMLEncode(rs("Notes").value))

will not error.

rs("Notes") returns a Field object. Server.HTMLEncode expects a variant. temp IS a variant. All that might have something to do with why assigning rs("Notes") to temp and then using temp worked and using rs("Notes") directly didn't.

jkruer01
01-12-2004, 04:40 PM
Thanks for your response. I appreciate it.

The reason that I am using HTMLEncode is because if a " is entered in that field, when I bring it up and try to display it in the textarea, everything after the " is cut off.

Thanks.

CardboardHammer
01-12-2004, 04:50 PM
DOH! Hadn't thought of that.