# Getting Rid of Error Divs around fields that have errors

**URL:** <https://www.ruby-forum.com/t/getting-rid-of-error-divs-around-fields-that-have-errors/67337>\
**Category:** Rails\
**Created:** [February 13, 2006, 8:57pm UTC](https://www.ruby-forum.com/t/getting-rid-of-error-divs-around-fields-that-have-errors/67337 "2006-02-13T20:57:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [February 13, 2006, 8:57pm UTC](https://www.ruby-forum.com/t/getting-rid-of-error-divs-around-fields-that-have-errors/67337/1 "2006-02-13T20:57:51Z")

</div>

Is there a way to get rid of the divs around an error field. These  
divs are causing me headaches. Any suggestions :-)?

John K.  
[http://www.kopanas.com](http://www.kopanas.com)

=====================================================================  
[http://www.soen.info](http://www.soen.info) - source of the freshest software engineering  
information on the net  
[http://cusec.soen.info](http://cusec.soen.info) - software engineering conference

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [February 13, 2006, 9:18pm UTC](https://www.ruby-forum.com/t/getting-rid-of-error-divs-around-fields-that-have-errors/67337/2 "2006-02-13T21:18:48Z")

</div>

Try this CSS to fix your layout problems.

div.fieldWithErrors { display:inline; }

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [February 13, 2006, 9:22pm UTC](https://www.ruby-forum.com/t/getting-rid-of-error-divs-around-fields-that-have-errors/67337/3 "2006-02-13T21:22:42Z")

</div>

I still get XHTML validation errors. I would like to just not have  
the extra divs added. There must be an easy way to do this?

On 13-Feb-06, at 3:17 PM, Bob S. wrote:

> Subject: [Rails] Getting Rid of Error Divs around fields that have  
> [http://www.soen.info](http://www.soen.info) - source of the freshest software engineering  
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

John K.  
[http://www.kopanas.com](http://www.kopanas.com)

=====================================================================  
[http://www.soen.info](http://www.soen.info) - source of the freshest software engineering  
information on the net  
[http://cusec.soen.info](http://cusec.soen.info) - software engineering conference

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [February 13, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/getting-rid-of-error-divs-around-fields-that-have-errors/67337/4 "2006-02-13T21:29:30Z")

</div>

> I still get XHTML validation errors. I would like to just not have  
> the extra divs added. There must be an easy way to do this?  
> in enviroment.rb put for example this (replace divs with spans)  
> ActionView::Base.field\_error\_proc = Proc.new { |html\_tag, instance|  
> “\<span class=“fieldWithErrors”\>#{html\_tag}” }

or for remove the divs:

ActionView::Base.field\_error\_proc = Proc.new { |html\_tag, instance|  
“#{html\_tag}” }
