button_to generates DIV

You might be interested in this snippet of code I saw somewhere and use in all my Rails apps.

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
"<span class=“error”>#{html_tag}<

/span>"

end

That fieldWithError div [a block element] around bad
form fields can really wreck a layout sometimes. An aptly named span
works just as well.

RSL

Ugh… That code should read:

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
“<span class=“error”>#{html_tag}”

end

RSL

Excellent. I just had that wreck a layout yesterday. Including this code should be easier and cleaner than hacking up the CSS.

Russell Norris wrote: