[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problem in displaying Textarea contents

Posted on 2003-10-22
10
Medium Priority
?
348 Views
Last Modified: 2010-05-19
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
0
Comment
Question by:sursatraj
10 Comments
 
LVL 17

Expert Comment

by:dorward
ID: 9604762
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
 

Author Comment

by:sursatraj
ID: 9604844
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
 

Author Comment

by:sursatraj
ID: 9604907
Hi,

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

Rgds
Surjit
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:dorward
ID: 9605035
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
 

Expert Comment

by:cliffhanger9
ID: 9607366
use the wrap property of the textarea tag
0
 
LVL 8

Expert Comment

by:fozylet
ID: 9610312
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
 

Author Comment

by:sursatraj
ID: 9625922
<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
 

Author Comment

by:sursatraj
ID: 9625929
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
 
LVL 17

Accepted Solution

by:
dorward earned 500 total points
ID: 9625976
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
 

Author Comment

by:sursatraj
ID: 9626053
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question