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

textarea input formatting to automatically replace spaces with <p>

Status
Not open for further replies.

mattys

Programmer
May 1, 2001
35
GB
Hi

I would like to know if there is a javascript 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)???

Thanks

Matt
 
Hi mattys,

Your title declares one thing and your post declares
a little different, are you wanting to replace a
&quot; &quot;(space) with a &quot;<p>&quot; in any text string found in the
text box.

2b||!2b
 
Hi

I have a text input form, which inputs text to a database. This text is then displayed on a web page. Before the text is cut and pasted into the textfield, it may have come from a word document (Microsoft). The text would be formatted with spaces, i.e. write a line, hit return and you get a new line, hit return twice and you get a paragraph. This is how it works in word, in notepad and on the text input form (text field whose input, when submitted, is sent to a database field).

From the text above to what I am writing here, I have hit return twice, thus forming a paragraph space.

The text in my textfield (which when submitted is sent to a field in database) looks like this. However, when displayed on a webpage (which sources from the database using asp), it does not retain spaces and will look like this:

'HiI have a text input form, which inputs text to a database. This text is then displayed on a web page. Before the text is cut and pasted into the textfield, it may have come from a word document (Microsoft). The text would be formatted with spaces, i.e. write a line, hit return and you get a new line, hit return twice and you get a paragraph. This is how it works in word, in notepad and on the text input form (text field whose input, when submitted, is sent to a database field).From the text above to what I am writing here, I have hit return twice, thus forming a paragraph space. The text in my textfield (which when submitted is sent to a field in database) looks like this. However, when displayed on a webpage (which sources from the database using asp), it does not retain spaces and will look like this:'

No spaces, no paragraphs. I would like the text to retain the spaces it has when you first cut and paste and the spaces which are actually visible in the database. So this space

would display on the web page.

Matt
 
first for new lines:
<%
'lets say txtstring is the text from DB
response.write replace(txtstring,vbcrlf,&quot;<BR>&quot;)

'next the spaces
response.write replace(txtstring,&quot; &quot;,&quot;&nbsp;&quot;)

'combine both to have desired visuals...
%>



Known is handfull, Unknown is worldfull
 
Hi thanks for that.

Where would i place it on the page?

Matt
 
in the displaying page...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top