Paragraph breaks in text areas

B

Bert Christensen

Is there any way to have paragraph breaks in form text areas so that the
breaks show up on the emailed results?

--

Bert Christensen, Toronto, Ontario
web: http://bertc.com

"You've got to fight every day to keep
mediocrity at bay" - Van Morrison
 
K

Kevin Spencer

Use text emails instead of HTML.

A line break is a "white space" HTML character. In HTML, whitespace
characters are all treated as a single space.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.
 
T

Trevor L.

Bert,
I came across the problem of not getting line breaks in an email generated
from a form

I resolved it by writing a script to submit the email
function sendform()
{
with (document.form1)
{
var body = ''
var i = elements.length , j = 0
while (i-- > 2) // drop last two elements - Submit and Reset
{
var tname = elements[j].name
var text = elements[j].value
body += tname
if (tname == "Comment")
body += '%0d%0a' // line break before comment text
body += text + '%0d%0a' // line break after each line
j += 1
} // end while
}
window.location = "mailto:" + "me" + "@" + "mysite" + ".com"
+ "?subject=Response%20from%20Form"
+ "&body=" + body
}

The line breaks are '%0d%0a'

I put one after each line of field name and field value and one between the
field name "Comments" and its value (on the assumption that comments will be
quite large anyway).

If you want double line breaks (as in a para.) use 2 single line breaks

The form looks like this
<form name="form1" action="">

<div style="background-color:#DBE0F5; padding:3px; font:75% arial;">
<b>Heading</b>
</div>

<div style="padding:10px; font:75% Arial; text-align:left;">
<p>
Hi all,<br />
<!-- more blurb -->

Name:<br/>
<input type="text" id="Name" value="Insert name" size="40"
onfocus="if (this.value=='Insert name'){this.value='';};return
false;"
onblur="if (this.value==''){this.value='Insert name';return
false;}"/><br/>

Email:<br/>
<input type="text" id="Email" value="Insert e-mail address" size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>

<!-- other <input>s in here -->

Enter Comment:<br/>
<textarea id="Comment" rows="10" cols="100"
style="font:100% Arial;">Enter your comment in
here</textarea><br />
</p>
</div>

<div align="center" style="background-color:#DBE0F5; padding:3px;
font:12px arial;">
<input type="button" id="submit" value=" Send "
onmouseover="testform()" onclick="sendform()" />
<input type="reset" id="reset" value=" Clear "/>
</div>
</form>

-
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top