Forum: Ruby on Rails options_for_select helper is also mess....

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.
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2007-05-10 09:11
I am 'trying' to use 'options_for_select'

<select name="selected_distance" id="selected_distance"
style="width:8%;">
<%= options_for_select(["2", "5", "10", "15", "25" ], @selected_distance
) %>
</select>

which generates the html....

<select name="selected_distance" id="selected_distance"
style="width8%;">
<option value="2">2</option>
<option value="5">5</option>
<option value="10" selected="selected">10</option>
<option value="15">15</option>
<option value="25">25</option>
</select>

but the dropdown selection is NOT selected,  first item always......
what's wrong ?

(OS X , Firefox)
This topic is locked and can not be replied to.