Stripping html from form inputs


#1

Ahoy m8ies,

Quick question.

Is there any existing demo code or a library which handles stripping
unwanted tags from form fields?

Also, a form might allow image tags, but we might want to strip out
any paramters other than SRC ?

Anohter issue is how handle inputs such as these:

  • 1 is less than 2
  • 1 is < than 2

In the second case, we need to guess that < is not opening a tag, and
convert it to a special character.

Thanks for any ideas or links!

Jasn


#2

Ahoy m8ies,

Quick question.

Is there any existing demo code or a library which handles stripping
unwanted tags from form fields?

You might look at strip_links and strip_tags

http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M000622

Also, look at the tidy library and gem

http://tidy.sourceforge.net/


#3

Is there any existing demo code or a library which handles stripping
unwanted tags from form fields?

Also, a form might allow image tags, but we might want to strip out
any paramters other than SRC ?

http://svn.techno-weenie.net/projects/plugins/white_list/README


Rick O.
http://weblog.techno-weenie.net
http://mephistoblog.com


#4

Wonderful, thanks Rick and Philip