Quantcast
Viewing all articles
Browse latest Browse all 8

Overriding the default div class="fieldWithErrors" (ActionView::Helpers::ActiveRecordHelper#error_message_on)

By default fields that are invalid are wrapped in:

<divclass="fieldWithErrors"><inputtype="text"name="blah"></div>

To override and wrap in spans instead of divs place the following in your environment.rb:

ActionView::Base.field_error_proc=Proc.new{|html_tag,instance|"<span class=\"fieldWithErrors\">#{html_tag}</span>"}

or to not use wrapping at all:

ActionView::Base.field_error_proc=Proc.new{|html_tag,instance|"#{html_tag}"}

Viewing all articles
Browse latest Browse all 8

Trending Articles