Forum Moderators: open

Message Too Old, No Replies

Multilined textboxes in forms

Getting them to pass along carriage returns

         

Weblamer

6:55 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Hello, Does anyone know how to setup a textbox in a form so that it passes along carriage returns?

I have a scrolling textbox form on one of my sites. The information the person fills out gets emailed to me. However, if they type this into a form:

Hello,
please send me more information!
sincerly,
bob user

it ends up comeing to me like:

Hello,please send me more information!sincerly,bob user

and it can be a bit of a pain sometimes when they have large lists entered into the textbox.

any help?

joshie76

7:15 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi WebLamer,

It should be passing up a carriage return but note that's not the same as a <br> tag.

What format is the e-mail (html/text/rtf etc) and how is it actually being sent (using a mailto: or some server script?)?

Weblamer

7:20 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Hello, thanks for the reply.
The form is being sent through the Jmail email componet on an ASP page.

The text in the textbox is stuck into a variable, which in turn is stuck into an HTML page the asp page generates and that whole thing is emailed.

Hmm.. on retrospect mayby i can use the replace function to replace char(10) with <br>....

Weblamer

7:34 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



it worked! yay me.

Text = replace(Text, vbcr, "<BR>")

webmasterworld is great. even if someoen doesent directly respond with an answere, its still a great sounding board to get yer brain thinking in a different direction.

Grumpus

7:53 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For future reference, when you are displaying blob text (multi-line forms/memo fields, etc) on an html tag, just add a <pre> tag around it.

<pre wrap> <% Recordset %> </pre>

In essence, your html page is looking for HTML text unless you tell it that it's not. Since this is preformatted, the <pre> tag does the trick. The "wrap" inside the tag just makes sure it doesn't make a really wide page if there's a long sentence/paragraph between CR's.

G.

joshie76

7:57 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, thats exactly where we would have gone when you replied "HTML". Yay you!

J

Weblamer

7:58 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Even better and simpler, thnx.

Grumpus

8:40 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When I first started working on my site, I'd done HTML design, and database design, but never a web database before (and ASP was a foreign thing to me). Took me three friggin' days to figure that one out! I'll never forget it, now!

G.

pageoneresults

8:51 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What about this one...

Inside the textarea tag include this attribute.

wrap="hard"

wrap

In Netscape and Microsoft browsers, this attribute controls word wrap behavior. A value of off for the attribute forces the <textarea> not to wrap text, so the viewer must manually enter line breaks.

A value of hard causes word wrap and includes line breaks in text submitted to the server.

A value of soft causes word wrap but removes line breaks from text submitted to the server.

Internet Explorer supports a value of physical, which is equivalent to Netcape's hard value, and a value of virtual, which is equivalent to Netscape's soft value.

If the wrap attribute is not included, text will still wrap under Internet Explorer, but under Netscape it will scroll horizontally in the text box. It is always a good idea to include the wrap attribute.

Grumpus

12:24 pm on Aug 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Pageone -

That'll work if you are displaying it in a Textarea form element, but in this case, we're writing it directly to the page. A textarea element will default to "hard", anyway.

G.

ukgimp

12:44 pm on Aug 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know this approach works when inserting into a DB and then reading it out again.

Response.Write Replace(MyString, chr(13),"<br />")

so when it inserts a form that has

1.one
2.two
3.three

inserts as

1.one(x)2.two(x)3.three

where (x) is whater it would be (dont know for certain) and then spits that out and puts the <BR> in .

Could that appproach help