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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function to format text in a text area so spaces become <p>

Status
Not open for further replies.

mattys

Programmer
Joined
May 1, 2001
Messages
35
Location
GB
Hi

I would like to know if there is an asp function I could add to a textarea in an asp input form (which adds info to an Access Database and displays on a webpage and which can be updated by another form on an online admin area)???

This is the asp code before the <body> of the document of the new info input form (for addition of new info to database, which is then displayed on webpage with asp):
Code:
RS(&quot;PropertyInfo&quot;) = Request.Form(&quot;PropertyInfo&quot;)
. This is the textarea:
Code:
<textarea name=&quot;PropertyInfo&quot; cols=&quot;40&quot; rows=&quot;5&quot; style=&quot;border: 1 solid #000080; padding-top: 0; padding-bottom: 0&quot;></textarea>

This is the asp code before the <body> of the document of the update info input form (to update current info stored on database, which is displayed on webpage with asp):
Code:
Conn.Execute (&quot;UPDATE Property SET Property.PropertyInfo='&quot; & Request.Form(&quot;PropertyInfo&quot;) & &quot;' &quot; & strWhereClause )
. This is the textarea:
Code:
<textarea name=&quot;PropertyInfo&quot; rows=&quot;15&quot; cols=&quot;50&quot; style=&quot;border: 1 solid #000080; padding-top: 0; padding-bottom: 0&quot;><%=RS(&quot;PropertyInfo&quot;)%></textarea>

Thanks

Matt
 
You want to read the content of an html page and see the code into an textarea? and then cahnge code and update file? ( like admin at )

________
George, M
 
Hi

I have an online admin area for an estate agent, where they can add new properties, images and long descriptions, etc. When they add a long description, say from a text file, or such like, in the input form textarea there are spaces, the text appears formatted, but it doesn't output with these spaces on the corresponding web page when called and displayed from the database using asp (when property info is added, say, for a new property, it is sent from the form to the Access database). The online admin area also has an area to update the corresponding property, or other properties. Just need a function like 'replace' to relace spaces with either two <br> tags or <p></p> tags.

Matt
 
Ok i understand now.
You could try to use Server.HTMLEncode(your string here) just before you save to database.

________
George, M
 
Hi

What does it do and where would I place it within the page?

Matt
 
shaddow, thanks for your help, but I don't think I have explained clearly. Sorry.

This is a new paragraph and I'm you will receive it as a new paragraph and not like this:

shaddow, thanks for your help, but I don't think I have explained clearly. Sorry.
This is a new paragraph and I'm you will receive it as a new paragraph and not like this:

I would like to be able to display text inputted into a text field as is, with spaces and new lines, for example,
This new line should display as a new line

This new para should display as a new para.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top