Wrox Programmer Forums
|
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 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 March 8th, 2004, 03:01 AM
Authorized User
 
Join Date: Jan 2004
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???

 
Old March 8th, 2004, 07:02 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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.
 
Old March 8th, 2004, 11:36 PM
Authorized User
 
Join Date: Jan 2004
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?

 
Old March 10th, 2004, 12:13 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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.





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





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