# Preventing fieldWithErrors from automatically being inserted

**URL:** <https://www.ruby-forum.com/t/preventing-fieldwitherrors-from-automatically-being-inserted/130259>\
**Category:** Rails\
**Created:** [February 26, 2008, 9:10pm UTC](https://www.ruby-forum.com/t/preventing-fieldwitherrors-from-automatically-being-inserted/130259 "2008-02-26T21:10:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ab992/32.png) [@knb](https://www.ruby-forum.com/u/knb)\
**Post date:** [February 26, 2008, 9:10pm UTC](https://www.ruby-forum.com/t/preventing-fieldwitherrors-from-automatically-being-inserted/130259/1 "2008-02-26T21:10:44Z")

</div>

How do I prevent the fieldWithErrors div from automatically being  
inserted into my html? I’d still like to use the error\_messages\_for  
method.

Thanks

kb

---

<div class="post-metadata">

**Author:** ![knb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ab992/32.png) [@knb](https://www.ruby-forum.com/u/knb)\
**Post date:** [February 26, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/preventing-fieldwitherrors-from-automatically-being-inserted/130259/2 "2008-02-26T21:24:53Z")

</div>

found the answer after doing some googling.

just insert this piece of code to override the proc that inserts the  
offending div.

put the code in environment.rb to do a global override. or put in a  
controller to keep it local.

ActionView::Base.field\_error\_proc = proc { |input, instance| input }

---

<div class="post-metadata">

**Author:** ![knb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ab992/32.png) [@knb](https://www.ruby-forum.com/u/knb)\
**Post date:** [March 19, 2008, 11:44am UTC](https://www.ruby-forum.com/t/preventing-fieldwitherrors-from-automatically-being-inserted/130259/3 "2008-03-19T11:44:59Z")

</div>

thanks
