# Changing the way form fields with errors are displayed

**URL:** <https://www.ruby-forum.com/t/changing-the-way-form-fields-with-errors-are-displayed/161816>\
**Category:** Rails\
**Created:** [March 2, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/changing-the-way-form-fields-with-errors-are-displayed/161816 "2009-03-02T19:25:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![giga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@giga](https://www.ruby-forum.com/u/giga)\
**Post date:** [March 2, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/changing-the-way-form-fields-with-errors-are-displayed/161816/1 "2009-03-02T19:25:34Z")

</div>

What file I must to edit?

7.1. Changing the way form fields with errors are displayed  
[http://guides.rubyonrails.org/activerecord\_validations\_callbacks.html](http://guides.rubyonrails.org/activerecord_validations_callbacks.html)

ActionView::Base.field\_error\_proc = Proc.new do |html\_tag, instance|  
if instance.error\_message.kind\_of?(Array)  
%(#{html\_tag}&nbsp;  
#{instance.error\_message.join(‘,’)})  
else  
%(#{html\_tag}&nbsp;  
#{instance.error\_message})  
end  
end

---

<div class="post-metadata">

**Author:** ![giga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@giga](https://www.ruby-forum.com/u/giga)\
**Post date:** [March 2, 2009, 7:27pm UTC](https://www.ruby-forum.com/t/changing-the-way-form-fields-with-errors-are-displayed/161816/2 "2009-03-02T19:27:49Z")

</div>

You don’t need to edit any files, create a file with this code and  
place it under you app initilizers folder.

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)

On Mon, Mar 2, 2009 at 3:25 PM, Fresh M.
