Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i Make an Auto Expanding Text Area??

Status
Not open for further replies.

essdee

Programmer
Nov 28, 2002
11
IN
HI all,
The User enters data in a text area. He may press enter several times.
This data is stored in the database and is seen by others on a diffrent page. I wish to display the data in the same manner as was entered by the user. If we need to use a text box for this then the scroller and the border of the text area should not be visible. Any ideas as to how this can be achieved?

Thanks in advance to all those who try to help me
 
When outputting the field data replace the line breaks with <br>'s:

Code:
Response.Write Replace(rs(&quot;textcol&quot;), Chr(13), &quot;<br>&quot;)
--James
 
the above code takes care of <enter> but does not handle <tab>. Both have to be handled
 
Response.Write Replace(rs(&quot;textcol&quot;), VbTab, &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;) =========================================================
while (!succeed) try();
-jeff
 
You can also use Chr(9) to check for tabs. Remember you'll need to use several &quot;& nbsp;&quot; (no space) to get the HTML to have more than one space. --James
 
Hi
I found another way to get around this, I put the data from the back end between <pre> </pre> tags. Theproblem with this is that if the user has typed a long line then this expands the browser horrizontally. Any Idea how to get around this.

 
Without a horizantal scrollbar the only way would be to come up with some maximum length (like 40) and print it out one line at a time, inserting a break if needed. Here is an example:
Code:
<%
Option Explicit

Dim strUserContent, MaxLength
MaxLength = 5

strUserContent = &quot;01234567890abcdefghifklmnopqrstuvwxyz&quot;

Do While len(strUserContent) > 0
   If Len(strUserContent) <= MaxLength Then
      Response.Write strUserContent
      strUserContent = &quot;&quot;
   ElseIf InStr(strUserContent,&quot;<br>&quot;) > MaxLength Then
      Response.Write Left(strUserContent,MaxLength) & &quot;!<br>&quot;
      strUserContent = Right(strUserContent,len(strUserContent) - MaxLength)
   ElseIf InStr(strUserContent,&quot;<br>&quot;) = 0 Then
      Response.Write Left(strUserContent,MaxLength) & &quot;!<br>&quot;
      strUserContent = Right(strUserContent,len(strUserContent) - MaxLength)
   Else
      Response.Write Left(strUserContent,InStr(strUserContent,&quot;<br>&quot;) + 4)
      strUserContent = Right(strUserContent,len(strUserContent) - InStr(strUserContent,&quot;<br>&quot;) - 4)
   End If
Loop
%>
01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top