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.
Jason B (Guest)
on 2007-01-19 17: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
Philip H. (Guest)
on 2007-01-19 19: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/
Rick O. (Guest)
on 2007-01-20 23: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 O.
http://weblog.techno-weenie.net
http://mephistoblog.com
Jason B (Guest)
on 2007-01-21 12:32
(Received via mailing list)
Wonderful, thanks Rick and Philip
This topic is locked and can not be replied to.