Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

radio_button can generate duplicate id attributes (invalid HTML)

#4862

Possibly related to #2937 id for radio_button behavior.

Sometimes, radio_button can generate duplicate id attributes.

Suppose you have this ERB:

<%= f.radio_button :winner_accepted, 1 %>
<%= f.radio_button :winner_accepted, -1 %>

You get this HTML:

<input id="nominee_winner_accepted_1" name="nominee[winner_accepted]" type="radio" value="1" /> 
<input id="nominee_winner_accepted_1" name="nominee[winner_accepted]" type="radio" value="-1" />

Reported by Paul Schreiber · June 14th, 2010 @ 08:50 PM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: none

Activity

  1. Rainer Blessing
    Rainer Blessing

    Only word characters (letters, digits, and underscores) are used from the value attribute. The attached patch would also allow a minus character.

    June 17th, 2010 @ 06:51 PM

  2. Rainer Blessing
  3. José Valim
    José Valim
    • Milestone cleared.
    • Assigned user set to José Valim

    Rainer, good patch! Could you please include tests as well?

    June 21st, 2010 @ 10:43 AM

  4. Neeraj Singh
  5. Repository
  6. Jeremy Kemper