Forum: Ruby on Rails Getting Rid of Error Divs around fields that have errors

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9904f8acaf66a3c1a4b4434676be11cf?d=identicon&s=25 John Kopanas (Guest)
on 2006-02-13 20:57
(Received via mailing list)
Is there a way to get rid of the divs around an error field.  These
divs are causing me headaches.  Any suggestions :-)?

John Kopanas
http://www.kopanas.com


=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference
Af93ba6b6b59f22a8f37e8de5702ef98?d=identicon&s=25 Bob Silva (Guest)
on 2006-02-13 21:18
(Received via mailing list)
Try this CSS to fix your layout problems.

div.fieldWithErrors { display:inline; }
9904f8acaf66a3c1a4b4434676be11cf?d=identicon&s=25 John Kopanas (Guest)
on 2006-02-13 21:22
(Received via mailing list)
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 Silva wrote:

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


John Kopanas
http://www.kopanas.com


=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference
Cf0076fc09a3b3b1ceff4b664dd7f4ed?d=identicon&s=25 Lukáš Konarovský (daeltar)
on 2006-02-13 21:29
> 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}</span>" }

or for remove the divs:

ActionView::Base.field_error_proc = Proc.new { |html_tag, instance|
    "#{html_tag}" }
This topic is locked and can not be replied to.