Preventing people from entering HTML in textarea

A

Angela

Hi,

I have a text area and I want prevent people from entering HTML text
in the text area.

Someone putting "</textarea></tr><img
src="http://www.xxx.com/images/pic.gif">" in the textarea will
manipulate the page if the page was revisited.

Does anyone have any ideas?

Thanks in advance

Angela
 
E

Evertjan.

Angela wrote on 05 mrt 2004 in comp.lang.javascript:
I have a text area and I want prevent people from entering HTML text
in the text area.

Someone putting "</textarea></tr><img
src="http://www.xxx.com/images/pic.gif">" in the textarea will
manipulate the page if the page was revisited.

only if you reenter that string from serverside,
so that asks for a serverside solution,
depending on your server language.

clientside it could be done by:

onchange=
"this.value=this.value.replace(/</g,"&lt;")

[not tested]

but clientside JS could be manipulated by a client too.
 
A

Angela Lam

I will be using ASP, so maybe I will have to use regExp to solve this
problem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top