Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 15th, 2005, 10:14 AM
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Storing Multiline Textbox value.

How to store and display multiline textbox value, i.e. with carriage retrun e.g. Address could be 3-4 line of text, but when i store it in a DB and display it in report it shows in a single line.

Thanks in advance.

  #2 (permalink)  
Old July 17th, 2005, 02:09 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

While displaying the data, use the following:

replace(rs("your_column_name"),vbCrlf,"<br>")

this will display data correctly.

Om Prakash
  #3 (permalink)  
Old July 17th, 2005, 05:58 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

You should run functions everytime you store and display information, to elaborate on the reply above.
To store: storeText(request.form("fieldname"))
  Function StoreText(theText)
    StoreText = ""
    on error resume next
    StoreText = CStr(theText)
    if (len(StoreText) > 0) Then
      StoreText = Replace(StoreText, """", "&quot;", 1, -1, 1)
      StoreText = Replace(StoreText, "'", "''", 1, -1, 1)
      StoreText = Replace(StoreText, vbCrLf, "<BR>", 1, -1, 1)
    end if
  End Function

To display:
  Function DisplayMemo(theText)
    DisplayMemo = ""
    on error resume next
    DisplayMemo = CStr(theText)
    if (len(DisplayMemo) > 0) Then
      DisplayMemo = Replace(DisplayMemo, vbCrLf, "<br>", 1, -1, 1)
    end if
  End Function


Wind is your friend
Matt
  #4 (permalink)  
Old July 18th, 2005, 08:17 AM
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

Everyting works fine except one thing, as I am using mulitline text box, the cursor goes to next line automatically, and hence user never presses Enter key and hence the context is shown in a single line, if user presses Enter key then the content is shown as we desire the result, so the problem is that how we can avoid auto scrolling to next line.
e.g. right now i m writing message in Message text box, here again cursor goes to
next line withou pressing enter.

Thankx in advance.


Rupen Anjaria.
We can't avoid problems, but ofcourse can solve it.
  #5 (permalink)  
Old July 18th, 2005, 06:08 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Sorry I dont understand your problem. To avoid irregular behaviors inside form elements run trim functions (in addition to the functions I gave you above). If you dont run functions around user defined info there is a good chance it will not store properly, therefore will not display properly.


Wind is your friend
Matt
  #6 (permalink)  
Old July 19th, 2005, 05:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Rupen,

I think your problem is related to the Horizontal scroll of multiline text box. When the line in which you type is full, it has got to go to the next line. But how does that give an impression of a NEW line. And how do you want it to be solved? One way I could think of is to increase the width of your text box, that too can be done as long as it fits into your screen, beyond which it is to behave the same manner. And the other way is not to type content that can exceed one the width of your text box.

My question is how does that impact the storage/display of it in your case?

_________________________
- Vijay G
Strive for Perfection
  #7 (permalink)  
Old July 20th, 2005, 07:02 AM
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

Even previous function has impact on display/storage.
Vijay you r right at point that it has to go to new line as soon as it is upto limit of hscroll, now what i want is that it should not go to new line automatically as you come to end of a line.

Further, It is like Comment/Description, so user may need to modify them, in that case above function stores <br> in original text and that again gets display.
And, I am not able to increase widht as it is too long already.

So, have any other solution??

Waiting for your reply.

Rupen Anjaria.
We can't avoid problems, but ofcourse can solve it.
  #8 (permalink)  
Old July 20th, 2005, 02:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Rupen,

My understanding is that, it will not replace/insert a "<BR>" there in first place, as you haven't pressed ENTER key. The function replaces only the vbCrLf with "<br>", so you shouldn't be seeing it there unless a carriage return in used explicitly.

_________________________
- Vijay G
Strive for Perfection


Similar Threads
Thread Thread Starter Forum Replies Last Post
AcceptsReturn multiline textbox suzila General .NET 19 March 10th, 2006 02:28 AM
Regular Expression for Multiline TextBox Dilip Nagle General .NET 3 January 6th, 2005 02:22 AM
How to make an uneditable multiline textbox ltdanp21 VS.NET 2002/2003 2 June 16th, 2004 06:19 PM
Multiline Text in Rich TextBox Niaz Pro VB 6 3 March 1st, 2004 07:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.