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.

in scaffold templates, change paragraph tags to fieldset tags

#1760

The current scaffold generator templates include paragraph tags <p> in the forms. A better HTML tag would be the <fieldset> tag.

This patch changes the <p> tags in the New and Edit templates to <fieldset> tags. It also changes the scaffold.css file so that it renders the default template exactly like the current template.

Reported by charliepark · January 14th, 2009 @ 02:12 PM

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

Activity

  1. charliepark
    charliepark

    Bah. Let's try that again.

    The current scaffold generator templates include paragraph tags <p> in the forms. A better HTML tag would be the <fieldset> tag.

    This patch changes the <p> tags in the New and Edit templates to <fieldset> tags. It also changes the scaffold.css file so that it renders the default template exactly like the current template.

    January 14th, 2009 @ 02:14 PM

  2. charliepark
    charliepark

    (My second post was just to clean up some formatting. I then went back and cleaned up the initial comment.)

    January 14th, 2009 @ 02:17 PM

  3. José Valim
    José Valim

    Quoting Damian Janowski from Rails core group:

    "A field set would make sense if you grouped fields like address, zip code and country inside a field set with a legend like "Your location"."

    So I'm -1 for this one also.

    http://groups.google.com/group/r...

    January 15th, 2009 @ 09:01 PM

  4. charliepark
    charliepark

    Is this the preferred place for discussion? Or at the Rails core e-mail list? Posting this to both.

    Clearly, the <p> tag is the wrong tag. If an input and a label require a wrapping container at all, what options do you have? <p> is for paragraphs of text. That's clearly not what the template is generating here. The other options would seem to be <div> and <fieldset>. I can see your point about fieldsets being for grouping more controls together, rather than an input and a related label, but shouldn't we at least convert that <p> to a <div>?

    January 15th, 2009 @ 10:29 PM

  5. Adam Milligan
    Adam Milligan

    HTML provides the definition list for exactly this scenario. Using dl/dt/dd seems more appropriate than either p or fieldset.

    January 16th, 2009 @ 03:47 PM

  6. Mislav
  7. joost baaij
    joost baaij

    Current best practise is to use an OL with each form element in a LI and style at will using CSS.

    Barring that +1 for the fieldset as it's the most semantic approach. It gives better context than just a div.

    January 27th, 2009 @ 03:49 PM

  8. DHH
    DHH
    • Assigned user set to DHH

    February 5th, 2009 @ 08:11 PM

  9. Mike Breen
    Mike Breen
    • Tag changed from generator, html, patch, scaffold, templates to bugmash, generator, html, patch, scaffold, templates

    -1 on use of fieldset and verified that patch does not apply cleanly to 2-3-stable

    August 10th, 2009 @ 12:20 AM

  10. Dan Croak
    Dan Croak

    -1 this particular patch. Jose's work on generators has been looking good.

    verified the patch does not apply cleanly to 2-3-stable.

    +1 on a patch from DHH, Jose, or someone in core with a comprehensive vision of better scaffolding. I'd suggest anything that looks like what Formtastic generates, because that gem is great.

    Don't want to debate markup semantics, just want Rails to choose a convention (like Formtastic), and make forms faster to write.

    August 10th, 2009 @ 04:17 AM

  11. Elad Meidar
    Elad Meidar

    -1 particular patch. verified patch does not apply on 2-3-stable.

    Not sure that paragraphs are indeed the "semantic" way to arrange a form, but it's a basic generator output and simple to change.

    August 10th, 2009 @ 05:12 AM

  12. José Valim
    José Valim
    • Assigned user changed from DHH to José Valim
    • Milestone cleared.

    Adam, definition list wouldn't be more appropriated for show?
    For new and edit I would agree that ol with li makes more sense.

    August 10th, 2009 @ 10:29 AM

  13. Repository
  14. José Valim
    José Valim
    • State changed from new to resolved

    September 1st, 2009 @ 12:16 PM

  15. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to

    October 15th, 2010 @ 11:01 PM

  16. bingbing