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.
John K. (Guest)
on 2006-02-13 21: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 K.
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
Bob S. (Guest)
on 2006-02-13 22:18
(Received via mailing list)
Try this CSS to fix your layout problems.

div.fieldWithErrors { display:inline; }
John K. (Guest)
on 2006-02-13 22: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 S. 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
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails


John K.
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
Lukáš K. (Guest)
on 2006-02-13 22: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.