Jump to content
xisto Community
Sign in to follow this  
sazz

How Do I Restrict Html Tag Entry In Textarea ?

Recommended Posts

On my site people may use some html code to enter into a textarea. However I don't wanna let them display images and links to other pages.To be exactly, I only want them to use:<P> & </P><EM> & </EM><U> & </U><STRONG> & </STRONG><P align=center> & </P><P align=left> & </P><P align=right> & </P><P align=justify> & </P>So I want to delete all other html tags & javascript, or anything else they can put in. What lines do I need to make sure they only use the tags above and for the rest plain text ?

Edited by microscopic^earthling (see edit history)

Share this post


Link to post
Share on other sites

the easiest way is to provide ur own tags...

instead of <p align=center></p> etc....

then u cancel html completely and convert ur own tags to the apropriate values when displaying...

 

but if u insist on keeping it html, though i see no reason why,

u can search and replace every tag u wish to keep with something like the

using regular expressions (not so hard)..

the killing all html, and then converting it back...

Share this post


Link to post
Share on other sites

Not knowing what software you are using or how your site is set up it would be hard to give you any advice on how to filter, or limit the use of certain tags, you already have the <P> covered it will wutomatically allow all <P> tags with attributes that you must specify such as the alignment feature which is an attribute of not only the <P> tag but others as well duch as the <DIV> or <SPAN> I suppose you could create a form that produces button that apply only those features you want but not knowing how you site works it is hard to tell you much more.A link to the site or perhaps some code that shows us just what you have right now would get more responses and probably a means to do what you want.See the Code below that defines some image icons for use in posting within a form.

<img src="images/url.gif"   border="0" accesskey='h' value=' http:// ' onclick='tag_url()'             name='url' onmouseover="hstat('url')" />	   <img src="images/img.gif"   border="0"accesskey='g' value=' IMG '     onclick='tag_image()'          name='img'   onmouseover="hstat('img')" />	   <img src="images/email.gif" border="0" accesskey='e' value='  @  '     onclick='tag_email()'         name='email' onmouseover="hstat('email')" />	   <br />		 <img src="images/quote.gif" border="0" accesskey='q' value=' QUOTE '   onclick='simpletag("QUOTE")'  name='QUOTE' onmouseover="hstat('quote')" />	   <img src="images/code.gif"  border="0"accesskey='p' value=' CODE '    onclick='simpletag("CODE")'     name='CODE' onmouseover="hstat('code')" />	   <img src="images/list.gif"  border="0" accesskey='l' value=' LIST '     onclick='tag_list()'          name="LIST" onmouseover="hstat('list')" /> 		 <br />

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.