Wrox Programmer Forums
|
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
 
Old June 15th, 2004, 11:25 AM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default Allowing HTML in form

Does anyone know the proper way to allow for HTML formatting when submitting through a form to a database? Formating such as bold, italic and such? I'm guessing it's going to require the replace function to some degree.

Any help is greatly appreciated!
Chris
 
Old June 15th, 2004, 06:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

May be you can do that while input of data into form fields, by adding <b>...</b> and <i>...</i> etc...

Or What type of data do you want to format?

If that is like, you want to bold one whole form field data, while inserting into DB, then you can use it this way.

Code:
StrCol1 = "<b>" & Request.Form("FieldVal") & "</b>"
ConnectionObj.Execute("Insert TableName Values('" & StrCol1 & "')"
Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 15th, 2004, 09:08 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

Thanks for responding Happy.

Basically, I'm having to place a digital (adobe acrobat) manual onto an intranet. I had a question answered the other day about replacing vbcrlf which helped me immensely.

So going on that premise, I decided I'd add to the principal of replacing for page breaks by adding the title, chapter, and so on via the same form. I want to be able to independently add html tags as need. The problem is when I tried adding the <b></b> tags, it showed up in the database and output exactly as that, <b></b>. So that kinda lead me to using the replace function.

Maybe I did something wrong originally, but I don't think I did. Do you see anything wrong with my theory of adding content via the form?
 
Old June 16th, 2004, 11:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

What database are you using? The database usually does not stick in text in a rich-text format so to speak. It won't use bold or italics in the database based on the font. However, when you render the content back to the browser, if you leave in those tags, the text will be bolded and such.

When dealing with HTML tags in data, you may have to use the Server.HtmlEncode and Serve.HtmlDecode tags to encode and decode the HTML. Encoded Html will appear as <b>text</b>, but Decoded Html will appear as text.

Brian
 
Old June 16th, 2004, 10:17 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

Brian -
I'm using access for this. I've never tried Server.HTMLEncode/Decode before. Whenever I've manually entered html tags, they are rendered out exactly as I put them in. i.e: <b></b>, etc.

Just when I think I've got a handle on something, it all gets blown out of the water. Guess that's what happens when you're self taught/still learning. All I can say is it's a good thing for this forum!
 
Old June 17th, 2004, 02:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am little confused on what you are trying to achieve.

Quote:
quote:Does anyone know the proper way to allow for HTML formatting when submitting through a form to a database? Formating such as bold, italic and such? I'm guessing it's going to require the replace function to some degree.
If you meant adding <b></b> tags around the form data to store them into database, I don't really see the need of using replace function here.

Quote:
quote:Basically, I'm having to place a digital (adobe acrobat) manual onto an intranet. I had a question answered the other day about replacing vbcrlf which helped me immensely.

So going on that premise, I decided I'd add to the principal of replacing for page breaks by adding the title, chapter, and so on via the same form.
Where does the content that you want to show on intranet come from? Is that you are reading from an adobe acrobat document to show on intranet? The form you mean is that a HTML FORM?

Still not sure if you wanted to store data into DB and then retrieve it from there to show on the intranet.
Cheers!



_________________________
-Vijay G
Strive for Perfection
 
Old June 17th, 2004, 04:53 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

Sorry about that...

We currently have some AS/400 manuals in PDF format. What I was asked to do was to display them in a traditional manner on the Intranet so that it could be edited and changed on a regular basis. I thought it was to be pure html for each chapter/section and so on. Turns out, it has to be scripted so that it can be edited as needed through a browser as the people that will be editing will not have html editors.

Because of the layout of the manuals some sections, and even individual words, throughout each chapter and section will have to be bolded, italicized, and so on. In some instances, I will have to call for images automatically. (I have the image part figured out)

I've built an html form and asp script that allows me to enter whole chapters and section into the database, along with the title, id, and sidenotes. I add html tags to the data being entered into the form where necessary.

Example entered in form: <b>blah blah blah:</b> <i>blah blah blah.</i>

Everything was great until I made the first test run and the html tags showed up just as I had entered them in the above example.

My original idea for this whole project was to just allow the people editing to have html editors, but that is not to happen. If anyone has a better idea on how to handle this issue, them I'm all ears. I'll even rename any one of my 3 daughters after you!

Chris
 
Old June 17th, 2004, 05:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Chris,

I think you are lucky. I just browsed the net and got this tool for you. It is lightweight, easy to use. Download this tool from here.

htmlArea - Turn any <textarea> into a WYSIWYG editor.

As I went through its FAQs and documentation, I believe that you can use it in your HTML form as a TEXTAREA itself they call it HTMLArea. I downloaded and just has a glimpse of how it works, but didnot test that out. I think this is what you are looking for.

Download it from there and go through the readme.html and example.html. That is more than sufficient to get it work.

Hope that helps. But if that works don't name one of your 3 daughters after me;), that doesn't suit. Just kidding. Good luck.

Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 17th, 2004, 06:54 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

Hey Vijay,

Thanks! Unfortunately, the link doesn't take you anywhere. Just opens a blank browser. I just noticed the formattable text here. How is it done on this board? Jeez... I hate being such an asp newbie. Some things I know without question, and other things I'm just dumb as a box of rocks.

Yeah... The name thing would be tough to explain. Then again, ever heard the song "a boy named sue..." ??

:o)

Thanks for your help!
 
Old June 17th, 2004, 07:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Sorry about that. Somehow missed pasting it there. Here it is.

htmlArea - Turn any <textarea> into a WYSIWYG editor.

Cheers!

_________________________
-Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
A possible solution regarding not allowing cachin malay mehta PHP How-To 0 March 12th, 2007 06:23 AM
How to refresh the page without allowing caching malay mehta PHP FAQs 0 March 5th, 2007 01:22 AM
Allowing Decimal values bright_mulenga Access 1 February 12th, 2007 12:38 PM
Converting an HTML Form to ASP.Net Form k_alidxb75 ASP.NET 1.x and 2.0 Application Design 0 November 30th, 2006 03:26 AM





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