Forum: Ruby on Rails stripping html from form inputs

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
75b30cd01949bd96fd1e96a81d808547?d=identicon&s=25 Jason B (Guest)
on 2007-01-19 16:30
(Received via mailing list)
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:

- <b>1 is less than 2</b>
- <b>1 is < than 2</b>

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
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-01-19 18:26
(Received via mailing list)
> 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/Help...

Also, look at the tidy library and gem

http://tidy.sourceforge.net/
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2007-01-20 22:34
(Received via mailing list)
> 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/whit...


--
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com
75b30cd01949bd96fd1e96a81d808547?d=identicon&s=25 Jason B (Guest)
on 2007-01-21 11:32
(Received via mailing list)
Wonderful, thanks Rick and Philip
This topic is locked and can not be replied to.