Forums

ASP

This topic is locked

HTML in textbox

Posted 29 Jan 2003 03:03:56
1
has voted
29 Jan 2003 03:03:56 Tony Chronopoulos posted:
Hello!!

How can I turn HTML off in textfields/textareas? If someone types <u>This is underlined</u> in my textfield, the text will actually be underlined.

Thanks.
Tony

___________________
microdesign² | www.microdesign2.com

Replies

Replied 29 Jan 2003 04:51:59
29 Jan 2003 04:51:59 Tony Chronopoulos replied:
I think I figured it out, but can someone tell me if this is the right way?


<pre id=code><font face=courier size=2 id=code>
Dim strTemp
strTemp = rsDetailed("nouvelles_text"

If (NOT isNull(strTemp)) Then
strTemp = replace(strTemp, "&lt;", "&lt;" 'disable html tag
strTemp = replace(strTemp, "&gt;", "&gt;" 'disable html tag
strTemp = replace(strTemp, "[ b ]", "&lt;b&gt;" ' *************************
strTemp = replace(strTemp, "[ /b ]", "&lt;/b&gt;" ' There's white spaces between
strTemp = replace(strTemp, "[ i ]", "&lt;i&gt;" ' the brackets so it can display
strTemp = replace(strTemp, "[ /i ]", "&lt;/i&gt;" ' properly in this message.
strTemp = replace(strTemp, "[ u ]", "&lt;u&gt;" ' *************************
strTemp = replace(strTemp, "[ /u ]", "&lt;/u&gt;"
strTemp = replace(strTemp, VbCrLf, "&lt;br&gt;"
Response.Write strTemp
End If

</font id=code></pre id=code>

Thanks !

Tony

___________________
microdesign² | www.microdesign2.com

Edited by - bloodtrain on 29 Jan 2003 04:54:54
Replied 29 Jan 2003 15:59:51
29 Jan 2003 15:59:51 Jørgen Emerslund replied:
That should do the trick.... I don't quite understand how you exclude HTML with the code here, but that's another story...
Replied 29 Jan 2003 20:58:48
29 Jan 2003 20:58:48 Tony Chronopoulos replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
That should do the trick.... I don't quite understand how you exclude HTML with the code here, but that's another story...
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
The reason why it doesn't make sense is because my code actually was translated. it's suppose to be: (without spaces)

strTemp = replace(strTemp, "&lt;", "& # 6 0 ;"
strTemp = replace(strTemp, "&gt;", "& # 6 2 ;"


I realized that the way it works is that my code replaces the brackets with the same brackets (to the naked eye) - but when it is compiled, the &#60; is not recognized as a bracket so html is disabled.

Yay! hehe.. it's fun figuring stuff out on your own! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

___________________
microdesign² | www.microdesign2.com

Reply to this topic