Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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
 
Old February 25th, 2004, 12:29 PM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Textarea and Replace problems

Hi,
I am currently developing a forum and have tried converting certain values with the REPLACE method. See the following code:

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\Message = Server.HTMLEncode(strMess) 'converts to safe HTML code
Message = Replace (Message, "'", "''") 'converts ' to ''
Message = Replace (Message, " ", " ") 'converts spaces to html space code
Message = Replace (Message, vbNewLine, "<br>") 'converts ENTER to a <br> tag
/////////////////////////////////////////////////////////////////////

All works fine when I manually press the enter key at the end of a line but when I keep typing and allow for the auto-wrap to take place then the message is continued on the same line.

I would like to use the Len() method to insert a <br> at a certain length of chars but I do not know how to do this.
Can anyone help?

Thanks in advance.:(

devplus e-com
 
Old February 25th, 2004, 04:27 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You'll have to do some math and use a combination of Len() and Mid() to check and break apart the string into chunks so you can put a "<br>" into them.

But this raises the question: Why be so restrictive with the width of the text? If you use the right HTML layout, the text should just wrap automatically where appropriate based on the user's current screen and browser sizes.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old February 25th, 2004, 04:40 PM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your reply.

My problem though is that my code uses an ASP only page to deal with the text submitted either from the top level postings or the replies page. This code then inserts the text into a database and when it is displayed in a web page it forces the screen width to adjust to the width of the continuous text line.

What do you suggest?

devplus e-com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Textarea Limiter problems kennethlove Javascript How-To 3 May 2nd, 2007 10:58 AM
Tab function + <textarea></textarea> Adam H-W HTML Code Clinic 0 April 24th, 2007 10:36 AM
Apostrophe in a textarea myself Classic ASP Professional 9 June 8th, 2006 07:32 AM
display vbCrLf's from textarea to textarea mat41 Classic ASP Basics 8 June 10th, 2004 12:19 AM
TextArea microchip Classic ASP Databases 2 March 17th, 2004 11:19 AM





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