简体   繁体   中英

very simple ruby combobox - text parse prolem

tried to create simple dropdown in ruby - like that :

<%= select_tag(:origin_id, '<option value="1">Lisbon</option>') %>

and I received an empy one.
this is the generated html

  <select id="origin_id" name="origin_id">&lt;option alue=&quot;1&quot;&gt;Lisbon&lt;/option&gt;/select>

将您的HTML标记为安全,以避免Rails对其进行转义。

<%= select_tag(:origin_id, '<option value="1">Lisbon</option>'.html_safe) %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM