Forum: Ruby on Rails select helper is a 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.
Kad K. (Guest)
on 2007-03-24 10:41
I am using a select helper in my partial view, as stated in the API doc

<%= select 'distance', 'radius', [["2 km" ,2], ["5 km", 5], ["10 km" ,
10], ["15 km", 15], ["25 kilomètres", 25] ], {:selected => 10}, {:style
=> 'width:90%;'}  %>

the generated html is right :

<select id="distance_radius" name="distance[radius]" style="width:90%;">
  <option value="2">2 km</option>
  <option value="5">5 km </option>
  <option value="10" selected="selected">10 km </option>
  <option value="15">15 km </option>
  <option value="25">25 km </option>
</select>

but the selected item in the dropdown remains always the first... (2 km)

what's wrong ?
Roland M. (Guest)
on 2007-03-24 11:39
(Received via mailing list)
Kad K. schrieb:
> I am using a select helper in my partial view, as stated in the API doc
[...]
>
> but the selected item in the dropdown remains always the first... (2 km)
>
> what's wrong ?


http://www.thescripts.com/forum/thread521870.html

hth

best regards,
Roland
This topic is locked and can not be replied to.