This project is archived and is in readonly mode.
select_tag doesn't generate options tag properly
-
Javix
I had to add 'html_save' on option I passed:
<p> <%= select_tag "colors", "<option>Red</option><option>Green</option><option>Blue</option>".html_safe%> </p>Would it be better to add it in the code source file actionpack/lib/action_view/helpers/form_tag_helper.rb, at lines 103 and 105 to 'option_tags' variable:
line 103: option_tags = "<option value=\"\">#{blank}</option>".html_safe + option_tags line 105: option_tags = "<option value=\"\"></option>".html_safe + option_tagsor one need to specify it always implicitly?
Edited by Rohit Arondekar for formatting.
-
Rohit Arondekar
- State changed from new to invalid
- Importance changed from to Low
Yes you need to mark a string as html_safe if you don't want it to be escaped. You can find more information in this excellent Railscast(ASCIIcast direct link)