This project is archived and is in readonly mode.

#3750 ✓invalid
Andreas Krüger

FormOptionsHelper's select method produces old <option selected>, not XHTML <option selected="selected">

Reported by Andreas Krüger | January 19th, 2010 @ 06:34 PM

This ticket is invalid.

I was mislead by a badly-constructed Webrat error message.

See https://webrat.lighthouseapp.com/projects/10503-webrat/tickets/345


For the record, the original text:

Hello,

I'm using the select method of ActionView::Helpers::FormOptionsHelper
as suggested by the documentation:

Example with @post.person_id => 2:

select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] })

I left out the {:include_blank => 'None'} part in the above quote and in my code.

Expected outcome:

<option value="2" selected="selected">Sam

Outcome seen:

<option value="2" selected>Sam

While this is accepted by many browsers, this isn't valid XHMTL.
Compare http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Transitional .

The documentation specifically promises the same outcome I expect.

Comments and changes to this ticket

  • Andreas Krüger

    Andreas Krüger January 19th, 2010 @ 06:37 PM

    Ooops...

    Let me quote the HTML:

    Exptected outcome:

    <option value="2" selected="selected">Sam</option>

    Outcome seen:

    <option value="2" selected>Sam</option>

  • Mike Riley

    Mike Riley July 29th, 2010 @ 03:59 PM

    • State changed from “new” to “invalid”
    • Importance changed from “” to “Low”

    Hello,

    I see you mentioned that this ticket is invalid. I am going to go mark it as such. If this is incorrect, let us know so we can investigate further.

    Mike Riley

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages