Click to See Complete Forum and Search --> : Carriage return not working in email table content


baldwingrand
02-12-2009, 01:38 PM
I have a form that, upon submission, sends an email to a particular group. There is quite a bit in the email, so I have put the contents in a table. All is working well, except for the "Comments" text area. This area can accept 200 characters, and in the email, all 200 characters display on one line. The user doesn't always enter a carriage return in the text field- so, how can I get this text to display in the cell with carriage returns? I have tried to restrict the width of the cells...to no avail. Any help appreciated. Thanks.


.HTMLBody = .HTMLBody & "<table border='1' width= '800'><tr><td colspan= '2' bgcolor='#CCCC99'><strong>Information</strong></td>" & vbCrLF & "</tr>"

.HTMLBody = .HTMLBody & "<tr><td width='400'><strong>Comments</strong>: </td><td width='400'>" & Replace(Request.Form("txtComments"), vbCrLf, "<br>") & "</td></tr></table>"



<textarea name="txtComments" id="txtComments" cols="100" rows="2"></textarea>

Mololo
02-13-2009, 02:24 PM
<textarea name="txtComments" id="txtComments" cols="100" rows="2" wrap="physical"></textarea>

Other attributes are "virtual" and "off". Hope it works for you.

Mololo
02-13-2009, 02:36 PM
But in your case, the best way should be this:
.HTMLBody = .HTMLBody & "<table border=1 width=800><tr><td colspan=2 bgcolor=CCCC99><strong>Information</strong></td>" & vbCrLF & "</tr>"

.HTMLBody = .HTMLBody & "<tr><td width=400><strong>Comments</strong>: </td><td width=400>" & Replace(Request.Form("txtComments"), vbCrLf, "<br>") & "</td></tr></table>"

I also underlined a break just in case it shouldn't be there... But this, you know better than me. ;)

baldwingrand
02-13-2009, 03:11 PM
I don't follow the last post? Isn't that what I have already? Thanks.

ryanbutler
02-13-2009, 03:35 PM
Maybe an extra <br> tag would do it? You're not pulling this from a database, correct?

Mololo
02-13-2009, 04:32 PM
I don't follow the last post? Isn't that what I have already? Thanks.

I removed all the '

baldwingrand
02-16-2009, 11:10 AM
looks like changing the wrap attribute to "hard" was all i needed. Thanks for all your help!

Mololo
02-16-2009, 03:10 PM
Problem solved, great!
But you should better use "physical" instead of "hard".

Here is a little something I found on some another website:
Modern browsers also support an alternate attribute set from
Microsoft: "soft", "hard", "off". These values have the same meaning
and effect, but the original Netscape set "logical", "physical" and
"off" has better cross-browser support, especially for legacy platforms.