Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4392 (new enhancement)

Opened 2 years ago

Last modified 7 months ago

[PATCH] Valid XHTML in scaffolds and error messages

Reported by: daniel@collectiveidea.com Assigned to: David
Priority: low Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: minor Keywords: xhtml scaffold fieldWithErrors
Cc:

Description

Make scaffold generator produce valid XHTML (transitional) but without any unneeded code (ex. meta tags from Ticket #1364).

I want to produce valid code without adding any extra baggage.

* Added the XHTML Transitional DOCTYPE to scaffold layout (required).

* Added <thead> and <tbody> elements to scaffold list views. (required for XHTML)

* Added a single <fieldset> around all scaffolded fields (required for XHTML).

* Changed <div class="fieldWithErrors"> to <span class="fieldWithErrors"> (Block level elements not allowed in this context. Span will work just the same, as the default style has display:table)

* Wrapped <label> around <input> and <textarea> elements. Not required, but recommended for accessibility.

Working often with strict doctypes, it is annoying to see Active Record errors spitting out invalid code. Also, scaffold code only needed a few tweaks to become valid.

All of these changes make the code valid up to XHTML 1.1, though I left the doctype as transitional to avoid problems.

Updated tests included.

Attachments

valid_xhmtl_for_scaffolds_and_errors.diff (21.8 kB) - added by daniel@collectiveidea.com on 03/24/06 04:41:08.
field_error_proc_doc_and_span_fix.diff (5.0 kB) - added by toolmantim on 12/17/07 02:38:12.
Adds documentation for field_error_proc and changes the div to a span

Change History

03/24/06 04:41:08 changed by daniel@collectiveidea.com

  • attachment valid_xhmtl_for_scaffolds_and_errors.diff added.

03/24/06 07:12:26 changed by anonymous

  • keywords changed from xhtml scaffold fieldWithErrors to xhtml scaffold fieldWithErrors needs_review.

03/24/06 08:38:47 changed by sebastien@goetzilla.info

Nice patch.

I reported the probleme here #3587.

03/25/06 21:35:43 changed by david

  • keywords changed from xhtml scaffold fieldWithErrors needs_review to xhtml scaffold fieldWithErrors.

04/06/06 20:34:16 changed by montanaharkin@yahoo.com

Did this make it into 1.1?

04/06/06 23:25:23 changed by daniel@collectiveidea.com

Sadly, no.

03/17/07 18:34:13 changed by josh

  • keywords changed from xhtml scaffold fieldWithErrors to xhtml scaffold fieldWithErrors tiny.
  • priority changed from normal to low.
  • version changed from 1.1.0 RC1 to edge.

06/08/07 00:40:40 changed by josh

  • keywords changed from xhtml scaffold fieldWithErrors tiny to xhtml scaffold fieldWithErrors.
  • milestone changed from 1.2.4 to 1.x.

Removed tiny because it changes the output of the html with "fieldWithErrors". People may be relying. I'm not saying it shouldn't be changed, its just not a quick fix.

12/17/07 02:38:12 changed by toolmantim

  • attachment field_error_proc_doc_and_span_fix.diff added.

Adds documentation for field_error_proc and changes the div to a span

12/17/07 02:47:52 changed by toolmantim

I've attached a simpler patch which simply adds some documentation and changes the default ActionView::Base.field_error_proc to wrap with a span instead of a div.

12/17/07 02:55:05 changed by toolmantim

You can find related discussion in the now-closed #3587