Problem in displaying Textarea contents

Hi,

I have described the problem below in points.Pls guide me to resovle this issue.

1. Copied data from Microsoft Word and pasted into the TextArea in the HTML Form
2. Saved TextArea contents into the database.
3 Retrieved Teaxtarea contents from the datbase and displayed on the html.
4. Text is displayed as long lines...horizontal scrolling is nuiscance to read long lines.

How should I restrict the lines so that horizontal scrolloing is avoided while displaying on the browser.


Rgds
Surjit
sursatrajAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dorwardCommented:
Its hard to know what's causing the problem without seeing the code, but my guess is that you are wrapping the data in a <pre> element. If you don't put line breaks then it will expand, so don't use a <pre> element.
0
sursatrajAuthor Commented:
Hi Dorward,

Ur r right...i am displaying data within pre tags to maintain the entered data as it is...

If I am displaying data without pre tags then it will be like big paragraph with no line breaks

Rgds,
Surjit
0
sursatrajAuthor Commented:
Hi,

Is there any workaround to avoid horizontal scrolling and maintain the format as enetred in the textarea.

Rgds
Surjit
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

dorwardCommented:
If the data is entered as one long line, then its impossible to avoid horizontal scrolling and keep it as it is - if you stop the horizontal scrolling, then the data will not be displayed as entered!

Probably you want to add a line break <br> to the end of each line in your (server side) script, or maybe wrap it in paragraph tags. Without seeing the data, its difficult to tell.
0
cliffhanger9Commented:
use the wrap property of the textarea tag
0
fozyletCommented:
Instead of <pre> try using

Replace(message_body,vbCrLf,"<br>")

if you're using ASP.
where message_body is the message you retrieve from the db.
0
sursatrajAuthor Commented:
<html><head><title>Testing Textarea</title></head><body>
<%
If request.Form("Submit") = "Submit" Then
      Dim output
      output = request.Form("textarea")      
End if
%>
<pre><%=output%></pre>
<form name="form1" method="post" action="">
  <textarea name="textarea" cols="20" rows="5"></textarea>
  <input type="submit" name="Submit" value="Submit">
</form>
</body></html>

Below is the junk line which checks for textarea of  "Posting Comment" I just wanted to know how Expert-exchange handles this

sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
0
sursatrajAuthor Commented:
Hi

When i tried above line "sssssssssss...." even exeprts-exchange doesn't take care of Text area contents...

So I think i have to program on the Server side

Rgds
Sujit
0
dorwardCommented:
Yes, the safe way is to check the length of each 'word' and should any exceed the limit, return it to the user with an error:

Sorry, 'words' longer then 25 characters are not allowed. Please insert some spaces to allow the content to wrap.

If you expect to be handling URIs you should take special steps to handle them. Possibly by allowing users to specify different display text, or by automatically cutting out the middle and sticking ... in its place. i.e.

http://www.veryveryveryveryverylong.com/long/long/long/long/long/long/long/long/long/long/this/is/rather/long/isnt/it?

becomes

<a href="http://www.veryveryveryveryverylong.com/long/long/long/long/long/long/long/long/long/long/this/is/rather/long/isnt/it?">http://www.veryvery.../long/isnt/it?</a>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sursatrajAuthor Commented:
Hi

I think the best way is display the contents again in another text area...so that we can avoid horizontal scrolling

Rgds
Surjit
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.