radio_button() problem with collections

Hi -
I think I'm seeing a bug in rails but am not sure. Maybe I'm just
struggling. Could somebody take a look at this?

I have a form to enter runner's times for an ultra marathon. The form
has 20 rows so we can enter 20 runners times at one submit. Each row has
the fields bibNumber, dayIn, timeIn, dayOut, and timeOut where we record
the times that a runner enters and departs a check point. I am using
radio buttons for the user to select the dayIn and dayOut fields and the
available choices are "Fri", "Sat", or "Sun", as it's a 48 hour race
spanning Friday 6am through Sunday 6am.

In my generated html, I can't get both the id attribute and the name
attribute to be indexed at the same time. I get either one but not both
depending on how I use the radio_button() helper.

If I use the following code in my partial, I see the subsequent html:

<%= radio_button(:runner_time, :dayIn, "Fri", {:index =>
runner_time_counter}) %><br/>
<%= radio_button(:runner_time, :dayIn, "Sat", {:index =>
runner_time_counter}) %>
<%= radio_button(:runner_time, :dayIn, "Sun", {:index =>
runner_time_counter}) %>

<input id="runner_time_dayIn_fri" name="runner_time[0][dayIn]"
type="radio" value="Fri" /><br/>
<input id="runner_time_dayIn_sat" name="runner_time[0][dayIn]"
type="radio" value="Sat" /><br/>
<input id="runner_time_dayIn_sun" name="runner_time[0][dayIn]"
type="radio" value="Sun" />

Notice the id isn't indexed, so on a form with 20 rows of this, my
<label for=""> tags can't reference unique radio buttons, they all end
up referencing the top one.

I have noticed if I use the following code, the id is indexed (or
unique), but the name isn't so my data isn't submitted correctly:

<%= radio_button(:runner_time, :dayIn, :value => "Fri", :index =>
runner_time_counter) %>
<%= radio_button(:runner_time, :dayIn, :value => "Sat", :index =>
runner_time_counter) %>
<%= radio_button(:runner_time, :dayIn, :value => "Sun", :index =>
runner_time_counter) %>

<input id="runner_time_dayIn_index0valuefri" name="runner_time[dayIn]"
type="radio" value="index0valueFri" />
<input id="runner_time_dayIn_index0valuesat" name="runner_time[dayIn]"
type="radio" value="index0valueSat" />
<input id="runner_time_dayIn_index0valuesun" name="runner_time[dayIn]"
type="radio" value="index0valueSun" />

Does anybody know how I get the id and name to be indexed so this page
will work?

Thank you!

So nobody's replied. I also did a search on radio_button and read the
posts that came up. There are about 3 other posts on this same subject
and NONE of them have replies. I think there's a bug here. If I get
time I'll look into the rails source and make a patch that works for me.
I don't know how to determine if it will function correctly for all
rails use cases, so I'll just post it here and let people use it if they

For now I'm under a tight deadline and I'll try to use radio_button_tag
and hand code the parameters, maybe that'll work.

Here's my solution using radio_button_tag. Several things appear to
It submits the dayIn and dayOut in a way that seems it will work
The <label for=""> tags work.
The only unknown will be if I can preset the values from the action
class before showing the page.

Just kidding. Here's the real solution:

<%= radio_button_tag("runner_time[" + runner_time_counter.to_s +
"][dayIn]", "Fri") %>
<label for="<%= 'runner_time_' + runner_time_counter.to_s + '_dayIn_fri'
<%= radio_button_tag("runner_time[" + runner_time_counter.to_s +
"][dayIn]", "Sat") %>
<label for="<%= 'runner_time_' + runner_time_counter.to_s + '_dayIn_sat'
<%= radio_button_tag("runner_time[" + runner_time_counter.to_s +
"][dayIn]", "Sun") %>
<label for="<%= 'runner_time_' + runner_time_counter.to_s + '_dayIn_sun'