Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 8th, 2004, 03:01 AM
Authorized User
 
Join Date: Jan 2004
Location: , , .
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default saving textfield format in database

hello ppl
i've gt a textfield that allows the user to type in some text, how do i save the format of the text in the database such that when i retrieve and display it again, it will look like how the user entered it?

e.g. user enters below:

some lines of text, blah blah blah
     *user pressed 'enter' and made some bullet-style text
     *2nd line
back to normal, no more bullet-style

i saw an example of how to do it somewhere in the past, can't remember is it in this forum or what, anyways, do i have to use javascript to check when the user pressed enter, or can i do it in asp???

Reply With Quote
  #2 (permalink)  
Old March 8th, 2004, 07:02 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you save the text exactly as they enter it, it should come back like that with the exception of the hard returns. Well, the hard returns WILL be there, but the browser will ignore them. You can either render what was typed in <pre></pre> or replace all occurances of vbcrlf in the text with a <br>.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old March 8th, 2004, 11:36 PM
Authorized User
 
Join Date: Jan 2004
Location: , , .
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thnks peter, using the replace method works...coz i dun understand the part abt rendering what's typed in <pre></pre>, what is it?

Reply With Quote
  #4 (permalink)  
Old March 10th, 2004, 12:13 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

<pre></pre> is for "preformatted" or something close to that.

Take the following block of text:

    here is the first line with 1 tab and a hard return
        here is the second line with 2 tabs and hard return
here is the third line with no tabs

If you dump this straight to the browser... it will render like this:

here is the first line with 1 tab and a hard return here is the second line with 2 tabs and hard return here is the third line with no tabs

because the browser ignores the tabs and the hard returns. It will wrap the end using the standard text flow rules. So you have to either replace the hard returns and tabs with appropriate substitutes (i.e. <br> and several &nbsp;) or you need to wrap the output in <pre></pre>. Using <pre></pre>, the above block should render EXACTLY like it exists. The browser will render with a fixed width font as well.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
saving files in windows format rage989 PHP How-To 0 August 30th, 2007 03:07 PM
Saving Image to sqlserver 2000 in binary format kvanchi General .NET 1 May 10th, 2005 07:24 AM
Saving datatables into database argeam ADO.NET 1 June 1st, 2004 08:59 AM
saving EPS format GraphicArmy BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 May 8th, 2004 04:59 AM
Saving Word file into Database melvik C# 0 March 8th, 2004 07:36 AM



All times are GMT -4. The time now is 04:11 AM.


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