Forums

This topic is locked

Preserve Formatting

Posted 25 Oct 2001 11:56:30
1
has voted
25 Oct 2001 11:56:30 david bloomfield posted:
Hi

How do you preserve formating of text in a textarea?

I basically want to be able to preserve the format of the text as it is done in this forum. How can i do this?

thanks david

Replies

Replied 25 Oct 2001 13:01:04
25 Oct 2001 13:01:04 Viktor Farcic replied:
If you mean on preserving information about new line use something like:

<%= Replace((RecordsetName.Fields.Item("FieldName".Value),vbcrlf, "<br>" %>

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi

How do you preserve formating of text in a textarea?

I basically want to be able to preserve the format of the text as it is done in this forum. How can i do this?

thanks david


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 25 Oct 2001 13:39:37
25 Oct 2001 13:39:37 david bloomfield replied:
hmm dunno..

what i want to be able to do is let a user insert some text into a database using a standard insert form.

then i want to pull that info out from the database and display it on a page with all the formatting preserved, i.e. paragraphs, indents, etc.

Im not sure how to use what you wrote before

sorry to be a pain

david

Replied 25 Oct 2001 16:55:25
25 Oct 2001 16:55:25 Viktor Farcic replied:
If you want to be able to preserve information about new line do following on page where you want to display information:

1. Insert DB field on the screen as usual.
2. Find code UD made. Something like:
&lt;%= RecordsetName.Fields.Item("FieldName".Value) %&gt;. To look for code click 'Show Code and Design Views' (top-left part of the screen).
3. Change code to look like
&lt;%= Replace((RecordsetName.Fields.Item("FieldName".Value),vbcrlf, "&lt;br&gt;" %&gt;

If you want to have ability to change font, size, insert link... search for extension 'Public Domain HTML Editor'. This extension will give you interface pretty much like one you saw in MS Word.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hmm dunno..

what i want to be able to do is let a user insert some text into a database using a standard insert form.

then i want to pull that info out from the database and display it on a page with all the formatting preserved, i.e. paragraphs, indents, etc.

Im not sure how to use what you wrote before

sorry to be a pain

david


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 25 Oct 2001 17:18:16
25 Oct 2001 17:18:16 david bloomfield replied:
thanks that works brilliantly

david <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Replied 25 Oct 2001 23:42:19
25 Oct 2001 23:42:19 Owen Eastwick replied:
As an extra, you can replace succesive items using multiple Replace statements that look for ASCII codes. For instance:

&lt;%= Replace((RecordsetName.Fields.Item("FieldName".Value),vbcrlf, "&lt;br&gt;" %&gt;

is the same as:

&lt;%= Replace((RecordsetName.Fields.Item("FieldName".Value),Chr(13), "&lt;br&gt;" %&gt;

If you wanted to replace spaces you could use:

&lt;%= Replace((RecordsetName.Fields.Item("FieldName".Value),Chr(32), "& nbsp;" %&gt;

So if you wanted to replace Line Breaks and Spaces:

varText = Replace((RecordsetName.Fields.Item("FieldName".Value),Chr(13), "&lt;br&gt;"
varText = Replace(varText, Chr(32), "& nbsp;"

(NOTE I have added a space between <b>&</b> and <b>nbsp;</b> so that it shows.)

Then display the text:

&lt;% = varText %&gt;

You can find all the ASCII Code values here: www.ascii.cl/

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Edited by - oeastwick on 10/25/2001 23:45:24
Replied 26 Oct 2001 10:58:52
26 Oct 2001 10:58:52 david bloomfield replied:
Thanks again

David <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic