Reply
remove unwanted HTML from <textarea> tags
Old 03-08-2008, 05:30 PM remove unwanted HTML from <textarea> tags
Super Talker

Posts: 120
Trades: 0
i made a page for a friend, and made him another page that edits it. It prints out all the html, then you can edit it and save it. The only problem is if he presses enter(to organize and stuff), its adds <BR> tags the page. How can I fix this?

And i cant jsut take out all the <BR>s, because he may type one in.
Skeddles is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 03-08-2008, 11:53 PM Re: remove unwanted HTML from <textarea> tags
Silent77's Avatar
Ultra Talker

Posts: 265
Name: Silent
Location: Ohio
Trades: 0
hard to debug something like that without a link and the code...
maybe you should post both
__________________
Firefox
rediscover the web
Get Firefox today it's free! Down with internet explorer!
Silent77 is offline
Reply With Quote
View Public Profile Visit Silent77's homepage!
 
Old 03-09-2008, 11:37 AM Re: remove unwanted HTML from <textarea> tags
chrishirst's Avatar
Super Moderator

Posts: 22,225
Location: Blackpool. UK
Trades: 0
find where the receiving code does a "replace(request.form("text_area_name")),vbcrlf,"< br>")" and comment it out.

may not be exactly as that but you should get something like it.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-03-2008, 09:41 AM Re: remove unwanted HTML from <textarea> tags
Junior Talker

Posts: 3
Name: Dominique Paris
Location: Luxembourg
Trades: 0
Generally, the key solution to remove ALL html tags from an input area is to use a Regex. (I do that in my site).
Here is the sample:
string commentText = Regex.Replace(this.txtComment.Text, @"<(.|\n)*?>", string.Empty).

If you want to preserve the formatting, just use a replace("<br">, "\r\n). This will insert a line feed carriage return.
cultureinside is offline
Reply With Quote
View Public Profile Visit cultureinside's homepage!
 
Old 10-17-2008, 12:28 AM Re: remove unwanted HTML from <textarea> tags
Sean@WMS's Avatar
Skilled Talker

Posts: 52
Name: Sean Connors
Location: Eureka, CA USA
Trades: 0
Quote:
Originally Posted by Skeddles View Post
i made a page for a friend, and made him another page that edits it. It prints out all the html, then you can edit it and save it. The only problem is if he presses enter(to organize and stuff), its adds <BR> tags the page. How can I fix this?

And i cant jsut take out all the <BR>s, because he may type one in.
If I understand you, you don't want to strip all HTML content out at all; you just want to get rid of these pesky break tags.

In the text area field, each of his line breaks is a carriage return/line freed. I agree with @chrishirst that there is most certainly a part of the processing script that is replacing all of those with a break tag.

Frankly, this is generally the right way to go about things. Maybe your friend is missusing line breaks "to organize and stuff"?
__________________
Web Merchant Services
Online Payment Processing, FREE shopping cart
Sean@WMS is offline
Reply With Quote
View Public Profile Visit Sean@WMS's homepage!
 
Reply     « Reply to remove unwanted HTML from <textarea> tags
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13216 seconds with 13 queries