 |
| 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
|
|
|
|

July 15th, 2005, 10:14 AM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
|
|
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.
|
|

July 17th, 2005, 02:09 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
|
|
While displaying the data, use the following:
replace(rs("your_column_name"),vbCrlf,"<br>")
this will display data correctly.
Om Prakash
|
|

July 17th, 2005, 05:58 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
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, """", """, 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
|
|

July 18th, 2005, 08:17 AM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
|
|
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.
|
|

July 18th, 2005, 06:08 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
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
|
|

July 19th, 2005, 05:09 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|
|

July 20th, 2005, 07:02 AM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
|
|
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.
|
|

July 20th, 2005, 02:21 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|
|
 |