Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying HTML tags in a text area 3

Status
Not open for further replies.

JohannIcon

Programmer
Sep 3, 2002
440
MT
Dear All,

I have a problem. I am retreiving data from an Access database and then display it in a text box. However, where there are HTML tags in the field, it is not displaying them properly. For exemple <b>Johann</b> is not displayed in bold but as it is coded, ie &quot;<b>Johann</b>&quot;. This problem only seems to occur in text area boxes, cause when I display them normally, ie
<%=(rs.Fields.Item(&quot;ItemText&quot;).Value)%>, it is displayed properly. How can I solve this problem?

Another thing, I used text area boxes so that I can display a scrollbar with the field, so that the user can scroll the information.

Thanks for your help
 
textarea boxes will only show plain text - it will not recognise HTML formatting other than as text. If you want a scrolling box with HTML formatted code then I would suggest using a <DIV> block. If you need any help with this then let me know.
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Yes please Tony, can you tell me how I can do that?

Thanks
 
try something like this:

Code:
<DIV STYLE=&quot;width: 300; height: 300; overflow-x: hidden; overflow-y: auto; background-color: #CDDDFD; padding: 2px;&quot;>
<P>place your HTML code here and it will be formatted correctly.</P>
<B>bold text</B><BR>
<I>italic text</I>

<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>

<P>some more <B>bold text</B> here</P>
</DIV>
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Hey mate, I tried it but it is still giving me the <a href:.........</a> link. This is the code I did:-

<DIV STYLE=&quot;width: 352; height: 300; background-color: #FFFFFF; border: 0; padding: 2px;&quot;>

<textarea style=&quot;background-color:#FFFFFF; font-family: arial; border: 0; font-size:9pt; letter-spacing:0px; color:GREY&quot; name=&quot;text&quot; cols=&quot;68&quot; readonly rows=&quot;21&quot;><%=(rs.Fields.Item(&quot;ItemText&quot;).Value)%></textarea>

</Div>
 
Don't use the text area tags. The DIV is going to replace your text area, so you will be outputting your db entry directly into the tags like so :
Code:
<DIV STYLE=&quot;width: 352; height: 300; background-color: #FFFFFF; border: 0; padding: 2px;&quot;>
<%=(rs.Fields.Item(&quot;ItemText&quot;).Value)%>
</Div>
Otherwise your db entry is still inside the textarea and being processed as text, even though the textarea was in a div.
Hope that helps,
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Ok Mate, it worked like this :-

<DIV STYLE=&quot;width: 352; height: 300; overflow-x: hidden; overflow-y: auto; background-color: #FFFFFF; border: 0; padding: 2px;&quot;>
<%=(rs.Fields.Item(&quot;ItemText&quot;).Value)%>
</Div>

But the problem is that it is not showing all the text that there is in the database. I tried to remove the overflow, but then I had no scrollbars. What I mean is that if I have 50 lines of code for example, it is only showing 30.

What do I have wrng?
 
Sorry mate,

Please don't take into condsideration my last reply, it is working great now! Thanks very much for your precious help!!!!

Thanks
 
Tony deserves more credit on this than I do, I just helped with the syntax, * for Tony :)
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top