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.

text_area_tag sanitize_to_id

#1703

text_area_tag('item[description]') should set id to "item_description" instead of "item[description]".

The unsanitized id with brackets fails HTML validation.

This is fixed by the attached simple patch file, which sets id to sanitize_to_id(name), instead of just name.

Test included.

Reported by sanderson (at nexttesting) · January 6th, 2009 @ 05:45 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Matt Jones
    Matt Jones
    • Tag changed from html, sanitize_to_id, validation to html, patch, sanitize_to_id, validation

    +1 - looks reasonable to me. Matches existing behavior and tests for other *_tag helpers.

    January 7th, 2009 @ 03:10 AM

  2. José Valim
  3. Angel N. Sciortino (angelic)
    Angel N. Sciortino (angelic)

    It makes sense to me, and the test looks good.

    January 8th, 2009 @ 03:26 PM

  4. Tim Cartwright
    Tim Cartwright

    This bug bit me when validating generated forms using the W3C’s HTML markup validator. Having a bug like this causes lots of error messages, making it difficult to see if there are other, more critical HTML errors. Plus, Rails just ought to generate clean HTML, IMO.

    January 8th, 2009 @ 03:50 PM

  5. Chris Mear
    Chris Mear
    • Tag changed from html, patch, sanitize_to_id, validation to html, patch, sanitize_to_id, validation, verified

    +1 Makes sense -- makes it consistent with other FormTagHelper methods, and test looks good.

    February 20th, 2009 @ 03:41 PM

  6. Michael Koziarski
    Michael Koziarski
    • State changed from new to resolved

    applied

    June 9th, 2009 @ 09:37 AM