Forum Moderators: open

Message Too Old, No Replies

Force returns in a textarea - help required

Is it possible to force returns in a <textarea>

         

Duncan

11:24 am on Oct 20, 2002 (gmt 0)

10+ Year Member



In my discussion forum I have a <textarea> for people to post messages but unfortunately it doesn't wrap the text so I end up with very long text strings, which means you have to scroll across the page to read the whole message.

Is it possible to force returns in a textarea to avoid getting this continuous string of text or is there another solution?

Birdman

11:36 am on Oct 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should be able to modify that in your htlm or css. However, if someone types a very long string with no spaces, I don't think there is anything you can do. You'll see it here sometimes when a long url is posted.

Edouard_H

2:09 pm on Oct 20, 2002 (gmt 0)

10+ Year Member



Add wrap="physical" to the textarea tag - still won't fix a continuous line of characters though.

Duncan

2:51 pm on Oct 20, 2002 (gmt 0)

10+ Year Member



Thanks for your replies. Unfortunately wrap="physical" does not seem to work, the server still returns one long string when the message is retrieved. Everything is fine if the user enter a carriage return, so I have set wrap="off" in the hope users will enter their own returns.

One way I guess would be if I left wrap="off" and had something that restricted the length of each line thereby forcing users to carriage return each time they reached the end of a line.

Any other ideas?

dingman

4:02 am on Oct 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How it can be accomplished will vary depending on the language your form processing app is written in, but if 'wrap="physical"' isn't working for you, you can wrap the input yourself after you receive it. In PHP, it's as simple as '$string = wordwrap(string);' There are optional arguments available if the default isn't quite right.